diff options
-rw-r--r-- | src/commands.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 29 |
2 files changed, 27 insertions, 4 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index a1f914734..fdaaece1b 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -867,7 +867,7 @@ void handle_quit(char **parameters, int pcnt, userrec *user) Write(user->fd,"ERROR :Closing link (%s@%s) [%s%s]",user->ident,user->host,PrefixQuit,parameters[0]); WriteOpers("*** Client exiting: %s!%s@%s [%s%s]",user->nick,user->ident,user->host,PrefixQuit,parameters[0]); WriteCommonExcept(user,"QUIT :%s%s",PrefixQuit,parameters[0]); - FOREACH_MOD OnUserQuit(user,parameters[0]); + FOREACH_MOD OnUserQuit(user,std::string(PrefixQuit)+std::string(parameters[0])); } else diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 8e0812bd7..172a36a14 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1314,24 +1314,47 @@ class ModuleSpanningTree : public Module virtual void OnUserConnect(userrec* user) { + char agestr[MAXBUF]; if (std::string(user->server) == Srv->GetServerName()) { log(DEBUG,"**** User on %s CONNECTS: %s",user->server,user->nick); std::deque<std::string> params; - sprintf(agestr,"%d",user->age); + snprintf(agestr,MAXBUF,"%d",user->age); params.clear(); params.push_back(agestr); params.push_back(user->nick); params.push_back(user->host); params.push_back(user->dhost); params.push_back(user->ident); - params.push_back("+"+std::string(user->modes)) + params.push_back("+"+std::string(user->modes)); params.push_back(user->ip); - params.push_back(":"+std::string(user->fullname)) + params.push_back(":"+std::string(user->fullname)); DoOneToMany(Srv->GetServerName(),"NICK",params); } } + virtual void OnUserQuit(userrec* user, std::string reason) + { + if (std::string(user->server) == Srv->GetServerName()) + { + log(DEBUG,"**** User on %s QUITS: %s",user->server,user->nick); + std::deque<std::string> params; + params.push_back(":"+reason); + DoOneToMany(user->nick,"QUIT",params); + } + } + + virtual void OnUserPostNick(userrec* user, std::string oldnick) + { + if (std::string(user->server) == Srv->GetServerName()) + { + log(DEBUG,"**** User on %s changes NICK: %s",user->server,user->nick); + std::deque<std::string> params; + params.push_back(user->nick); + DoOneToMany(oldnick,"NICK",params); + } + } + virtual ~ModuleSpanningTree() { delete Srv; |