diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-15 03:24:09 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-06-15 03:24:09 +0000 |
commit | f35042f332fbc55dd1513ea08ee6741f82501311 (patch) | |
tree | cc0869c9553584737afdafd2018644787c78fdbf | |
parent | e6fee8bcfb6e543452dbe926e5030e1aa72810b6 (diff) |
Use PUSH to let remote servers advise of errors.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7328 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/m_spanningtree/rsquit.cpp | 24 | ||||
-rw-r--r-- | src/modules/m_spanningtree/rsquit.h | 1 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index 979dd1bae..66de4ddc1 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -63,13 +63,15 @@ CmdResult cmd_rsquit::Handle (const char** parameters, int pcnt, userrec *user) { if (s == Utils->TreeRoot) { - ServerInstance->SNO->WriteToSnoMask('l',"RSQUIT: %s told me to SQUIT myself! (%s matches local server name)",user->nick,parameters[1]); + //ServerInstance->SNO->WriteToSnoMask('l',"RSQUIT: %s told me to SQUIT myself! (%s matches local server name)",user->nick,parameters[1]); + NoticeUser(user, "*** RSQUIT: Foolish mortal, you cannot make a server SQUIT itself! ("+ConvToStr(parameters[1])+" matches local server name)"); return CMD_FAILURE; } TreeSocket* sock = s->GetSocket(); if (!sock) { - ServerInstance->SNO->WriteToSnoMask('l',"RSQUIT: %s told me to SQUIT \002%s\002 but the server isn't linked here.",user->nick,parameters[1]); + //ServerInstance->SNO->WriteToSnoMask('l',"RSQUIT: %s told me to SQUIT \002%s\002 but the server isn't linked here.",user->nick,parameters[1]); + NoticeUser(user, "*** RSQUIT: Server \002"+ConvToStr(parameters[1])+"\002 isn't connected to \002"+ConvToStr(parameters[0])+"\002."); return CMD_FAILURE; } ServerInstance->SNO->WriteToSnoMask('l',"Remote SQUIT from %s matching \002%s\002, squitting server \002%s\002",user->nick,parameters[0],parameters[1]); @@ -83,7 +85,7 @@ CmdResult cmd_rsquit::Handle (const char** parameters, int pcnt, userrec *user) { if (s == Utils->TreeRoot) { - user->WriteServ("NOTICE %s :*** RSQUIT: Foolish mortal, you cannot make a server SQUIT itself! (%s matches local server name)",user->nick,parameters[0]); + NoticeUser(user, "*** RSQUIT: Foolish mortal, you cannot make a server SQUIT itself! ("+ConvToStr(parameters[0])+" matches local server name)"); return CMD_FAILURE; } TreeSocket* sock = s->GetSocket(); @@ -99,3 +101,19 @@ CmdResult cmd_rsquit::Handle (const char** parameters, int pcnt, userrec *user) return CMD_SUCCESS; } + +void cmd_rsquit::NoticeUser(userrec* user, const std::string &msg) +{ + if (IS_LOCAL(user)) + { + user->WriteServ("NOTICE %s :%s",user->nick,msg.c_str()); + } + else + { + //bool DoOneToOne(const std::string &prefix, const std::string &command, std::deque<std::string> ¶ms, std::string target); + std::deque<std::string> params; + params.push_back(user->nick); + params.push_back("NOTICE "+ConvToStr(user->nick)+" :"+msg); + Utils->DoOneToOne(ServerInstance->Config->ServerName, "PUSH", params, user->server); + } +} diff --git a/src/modules/m_spanningtree/rsquit.h b/src/modules/m_spanningtree/rsquit.h index 155d375bd..81e9bc2b7 100644 --- a/src/modules/m_spanningtree/rsquit.h +++ b/src/modules/m_spanningtree/rsquit.h @@ -23,6 +23,7 @@ class cmd_rsquit : public command_t public: cmd_rsquit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); CmdResult Handle (const char** parameters, int pcnt, userrec *user); + void NoticeUser(userrec* user, const std::string &msg); }; #endif |