diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 4 | ||||
-rw-r--r-- | src/modules/m_spanningtree/rsquit.cpp | 50 | ||||
-rw-r--r-- | src/modules/m_spanningtree/rsquit.h | 28 |
4 files changed, 88 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index c1e462697..99041dc0d 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -33,8 +33,9 @@ #include "m_spanningtree/link.h" #include "m_spanningtree/treesocket.h" #include "m_spanningtree/rconnect.h" +#include "m_spanningtree/rsquit.h" -/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h */ +/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h */ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) : Module(Me), max_local(0), max_global(0) @@ -43,6 +44,8 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) Utils = new SpanningTreeUtilities(Me, this); command_rconnect = new cmd_rconnect(ServerInstance, this, Utils); ServerInstance->AddCommand(command_rconnect); + command_rsquit = new cmd_rsquit(ServerInstance, this, Utils); + ServerInstance->AddCommand(command_rsquit); if (Utils->EnableTimeSync) { SyncTimer = new TimeSyncTimer(ServerInstance, this); @@ -385,7 +388,7 @@ void ModuleSpanningTree::HandleMap(const char** parameters, int pcnt, userrec* u return; } -int ModuleSpanningTree::HandleSquit(const char** parameters, int pcnt, userrec* user) +int ModuleSpanningTree::HandleSquit(const char** parameters, int pcnt, userrec* user, bool remote) { TreeServer* s = Utils->FindServerMask(parameters[0]); if (s) @@ -406,6 +409,8 @@ int ModuleSpanningTree::HandleSquit(const char** parameters, int pcnt, userrec* } else { + if (!remote && IS_LOCAL(user)) + user->WriteServ("NOTICE %s :*** WARNING: Using SQUIT to split remote servers is deprecated and will be removed in a future version. Please use RSQUIT instead.",user->nick); /* route it */ std::deque<std::string> params; params.push_back(parameters[0]); diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index aea1d1a42..2052607c6 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -31,6 +31,7 @@ const long ProtocolVersion = 1105; /** Forward declarations */ class cmd_rconnect; +class cmd_rsquit; class SpanningTreeUtilities; class TimeSyncTimer; class CacheRefreshTimer; @@ -46,6 +47,7 @@ class ModuleSpanningTree : public Module unsigned int max_local; unsigned int max_global; cmd_rconnect* command_rconnect; + cmd_rsquit* command_rsquit; SpanningTreeUtilities* Utils; public: @@ -101,7 +103,7 @@ class ModuleSpanningTree : public Module /** Handle SQUIT */ - int HandleSquit(const char** parameters, int pcnt, userrec* user); + int HandleSquit(const char** parameters, int pcnt, userrec* user, bool remote=false); /** Handle TIME */ diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp new file mode 100644 index 000000000..2077bd68c --- /dev/null +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -0,0 +1,50 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" +#include "configreader.h" +#include "users.h" +#include "channels.h" +#include "modules.h" +#include "commands/cmd_whois.h" +#include "commands/cmd_stats.h" +#include "socket.h" +#include "wildcard.h" +#include "xline.h" +#include "transport.h" + +#include "m_spanningtree/timesynctimer.h" +#include "m_spanningtree/resolvers.h" +#include "m_spanningtree/main.h" +#include "m_spanningtree/utils.h" +#include "m_spanningtree/treeserver.h" +#include "m_spanningtree/link.h" +#include "m_spanningtree/treesocket.h" +#include "m_spanningtree/rsquit.h" + +/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rsquit.h */ + +cmd_rsquit::cmd_rsquit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util) : command_t(Instance, "RSQUIT", 'o', 1), Creator(Callback), Utils(Util) +{ + this->source = "m_spanningtree.so"; + syntax = "<remote-server-mask> <target-server-mask>"; +} + +CmdResult cmd_rsquit::Handle (const char** parameters, int pcnt, userrec *user) +{ + if (IS_LOCAL(user)) + { + return (CmdResult)((ModuleSpanningTree*)Creator)->HandleSquit(parameters, pcnt, user, true); + } + return CMD_SUCCESS; +} diff --git a/src/modules/m_spanningtree/rsquit.h b/src/modules/m_spanningtree/rsquit.h new file mode 100644 index 000000000..155d375bd --- /dev/null +++ b/src/modules/m_spanningtree/rsquit.h @@ -0,0 +1,28 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#ifndef __RSQUIT_H__ +#define __RSQUIT_H__ + +/** Handle /RCONNECT + */ +class cmd_rsquit : public command_t +{ + Module* Creator; /* Creator */ + SpanningTreeUtilities* Utils; /* Utility class */ + public: + cmd_rsquit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); + CmdResult Handle (const char** parameters, int pcnt, userrec *user); +}; + +#endif |