From de6a9294e350a7339e280ab3e8a5f4c8d1343660 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 29 Nov 2005 17:09:06 +0000 Subject: Added opertype to OnOper and added OnMode function git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2010 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/modules/m_spanningtree.cpp') 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 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 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 params; + params.push_back(opertype); + DoOneToMany(user->nick,"OPERTYPE",params); + } + } + virtual ~ModuleSpanningTree() { delete Srv; -- cgit v1.2.3