diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.cpp | 2 | ||||
-rw-r--r-- | src/mode.cpp | 5 | ||||
-rw-r--r-- | src/modules.cpp | 3 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_operjoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_opermodes.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_opermotd.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 35 |
9 files changed, 46 insertions, 15 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index fdaaece1b..c1b7ce82e 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1589,7 +1589,7 @@ void handle_oper(char **parameters, int pcnt, userrec *user) { strcat(user->modes,"o"); WriteServ(user->fd,"MODE %s :+o",user->nick); - FOREACH_MOD OnOper(user); + FOREACH_MOD OnOper(user,OperType); log(DEFAULT,"OPER: %s!%s@%s opered as type: %s",user->nick,user->ident,user->host,OperType); AddOper(user); } diff --git a/src/mode.cpp b/src/mode.cpp index 32033e7f4..6461ee311 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -1140,6 +1140,7 @@ void process_modes(char **parameters,userrec* user,chanrec *chan,int status, int { log(DEBUG,"Local mode change"); WriteChannelLocal(chan, user, "MODE %s %s",chan->name,outstr); + FOREACH_MOD OnMode(user, chan, TYPE_CHANNEL, outstr); } else { @@ -1459,6 +1460,7 @@ void handle_mode(char **parameters, int pcnt, userrec *user) if (strcmp(b,"")) { WriteTo(user, dest, "MODE %s :%s", dest->nick, b); + FOREACH_MOD OnMode(user, dest, TYPE_USER, b); } if (strlen(dmodes)>MAXMODES) @@ -1712,6 +1714,7 @@ void server_mode(char **parameters, int pcnt, userrec *user) if (strcmp(b,"")) { WriteTo(user, dest, "MODE %s :%s", dest->nick, b); + FOREACH_MOD OnMode(user, dest, TYPE_USER, b); } if (strlen(dmodes)>MAXMODES) @@ -2098,7 +2101,7 @@ void merge_mode2(char **parameters, int pcnt, userrec* user) if (strcmp(b,"")) { WriteTo(user,dest,"MODE %s :%s",dest->nick,b); - log(DEBUG,"Sent: :%s MODE %s",user->nick,b); + FOREACH_MOD OnMode(user, dest, TYPE_USER, b); } if (strlen(dmodes)>MAXMODES) diff --git a/src/modules.cpp b/src/modules.cpp index 61abe5564..ec1f03eee 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -316,8 +316,9 @@ void Module::OnRehash() { } void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { } int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; } int Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) { return false; } +void Module::OnMode(userrec* user, void* dest, int target_type, std::string text); Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR); } -void Module::OnOper(userrec* user) { }; +void Module::OnOper(userrec* user, std::string opertype) { }; void Module::OnInfo(userrec* user) { }; void Module::OnWhois(userrec* source, userrec* dest) { }; int Module::OnUserPreInvite(userrec* source,userrec* dest,chanrec* channel) { return 0; }; diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 0596fdc74..d47dc7190 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -190,7 +190,7 @@ class ModuleSQLLog : public Module InsertEntry((unsigned)category,(unsigned)nickid,(unsigned)hostid,(unsigned)sourceid,(unsigned long)time(NULL)); } - virtual void OnOper(userrec* user) + virtual void OnOper(userrec* user, std::string opertype) { AddLogEntry(LT_OPER,user->nick,user->host,user->server); } diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 8df47ce3d..9dbbd088f 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -198,14 +198,6 @@ class ModuleHelpop : public Module } } - virtual void OnOper(userrec* user) - { - char* modes[2]; // only two parameters - modes[0] = user->nick; // first parameter is the nick - modes[1] = "+h"; // second parameter is the mode - Srv->SendMode(modes,2,user); // send these, forming the command "MODE <nick> +h" - } - virtual ~ModuleHelpop() { delete Srv; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 980fcc651..3609350a2 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -42,7 +42,7 @@ class ModuleOperjoin : public Module { } - virtual void OnOper(userrec* user) { + virtual void OnOper(userrec* user, std::string opertype) { if(operChan != "") { diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 063e675fc..7bfc67f6b 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -48,7 +48,7 @@ class ModuleModesOnOper : public Module return Version(1,0,0,1,VF_VENDOR); } - virtual void OnOper(userrec* user) + virtual void OnOper(userrec* user, std::string opertype) { // whenever a user opers, go through the oper types, find their <type:modes>, // and if they have one apply their modes. The mode string can contain +modes diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index ffdb7da90..3d79ab13e 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -80,7 +80,7 @@ class ModuleOpermotd : public Module { } - virtual void OnOper(userrec* user) { + virtual void OnOper(userrec* user, std::string opertype) { ShowOperMOTD(user); 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; |