summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree.cpp')
-rw-r--r--src/modules/m_spanningtree.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 172a36a14..38b1f7784 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -604,6 +604,24 @@ class TreeSocket : public InspSocket
return false;
}
+ bool OperType(std::string prefix, std::deque<std::string> params)
+ {
+ if (params.size() != 1)
+ return true;
+ std::string opertype = params[0];
+ userrec* u = Srv->FindNick(prefix);
+ if (u)
+ {
+ strlcpy(u->oper,opertype.c_str(),NICKMAX);
+ if (!strchr(u->modes,"o"))
+ {
+ strcat(u->modes,"o");
+ }
+ DoOneToAllButSender(u->server,"OPERTYPE",params,u->server);
+ }
+ return true;
+ }
+
bool RemoteServer(std::string prefix, std::deque<std::string> params)
{
if (params.size() < 4)
@@ -832,6 +850,10 @@ class TreeSocket : public InspSocket
{
return this->RemoteServer(prefix,params);
}
+ else if (command == "OPERTYPE")
+ {
+ return this->OperType(prefix,params);
+ }
else if (command == "SQUIT")
{
if (params.size() == 2)
@@ -1355,6 +1377,19 @@ class ModuleSpanningTree : public Module
}
}
+ // note: the protocol does not allow direct umode +o except
+ // via NICK with 8 params. sending OPERTYPE infers +o modechange
+ // locally.
+ virtual void OnOper(userrec* user, std::string opertype)
+ {
+ if (std::string(user->server) == Srv->GetServerName())
+ {
+ std::deque<std::string> params;
+ params.push_back(opertype);
+ DoOneToMany(user->nick,"OPERTYPE",params);
+ }
+ }
+
virtual ~ModuleSpanningTree()
{
delete Srv;