diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:28 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:28 +0000 |
commit | fc4d8fc4cc409770c0488c7b56f1b140dcbd2397 (patch) | |
tree | 6f360605185e2ed6fb61b0cec55b4947e32d0c3c /src/modules | |
parent | 68174076d7d665340ca992f88013dc2e6035a0a8 (diff) |
Change more modules to use VF_OPTCOMMON routing
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11654 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_remove.cpp | 43 | ||||
-rw-r--r-- | src/modules/m_sajoin.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_sakick.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_sanick.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_sapart.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_saquit.cpp | 13 |
6 files changed, 76 insertions, 23 deletions
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 49c74d9ce..b2763d86a 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -23,14 +23,14 @@ /** Base class for /FPART and /REMOVE */ -class RemoveBase +class RemoveBase : public Command { private: bool& supportnokicks; - InspIRCd* ServerInstance; - protected: - RemoveBase(InspIRCd* Instance, bool& snk) : supportnokicks(snk), ServerInstance(Instance) + public: + RemoveBase(InspIRCd* Instance, Module* Creator, bool& snk, const char* cmdn, const char* a, int b, int c, bool d, int e) + : Command(Instance, Creator, cmdn, a,b,c,d,e), supportnokicks(snk) { } @@ -69,7 +69,7 @@ class RemoveBase } } - CmdResult Handle (const std::vector<std::string>& parameters, User *user, bool neworder) + CmdResult HandleRMB(const std::vector<std::string>& parameters, User *user, bool neworder) { const char* channame; const char* username; @@ -196,18 +196,18 @@ class RemoveBase return CMD_FAILURE; } - /* route me */ return CMD_SUCCESS; } + virtual RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) = 0; }; /** Handle /REMOVE */ -class CommandRemove : public Command, public RemoveBase +class CommandRemove : public RemoveBase { public: CommandRemove(InspIRCd* Instance, Module* Creator, bool& snk) - : Command(Instance, Creator, "REMOVE", 0, 2, 2, false, 0), RemoveBase(Instance, snk) + : RemoveBase(Instance, Creator, snk, "REMOVE", 0, 2, 2, false, 0) { syntax = "<nick> <channel> [<reason>]"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); @@ -215,24 +215,41 @@ class CommandRemove : public Command, public RemoveBase CmdResult Handle (const std::vector<std::string>& parameters, User *user) { - return RemoveBase::Handle(parameters, user, false); + return HandleRMB(parameters, user, false); + } + + RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) + { + User* dest = ServerInstance->FindNick(parameters[0]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; } }; /** Handle /FPART */ -class CommandFpart : public Command, public RemoveBase +class CommandFpart : public RemoveBase { public: CommandFpart(InspIRCd* Instance, Module* Creator, bool& snk) - : Command(Instance, Creator, "FPART", 0, 2), RemoveBase(Instance, snk) + : RemoveBase(Instance, Creator, snk, "FPART", 0, 2, 2, false, 0) { syntax = "<channel> <nick> [<reason>]"; + TRANSLATE4(TR_TEXT, TR_NICK, TR_TEXT, TR_END); } CmdResult Handle (const std::vector<std::string>& parameters, User *user) { - return RemoveBase::Handle(parameters, user, true); + return HandleRMB(parameters, user, true); + } + + RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) + { + User* dest = ServerInstance->FindNick(parameters[1]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; } }; @@ -272,7 +289,7 @@ class ModuleRemove : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("$Id$", VF_OPTCOMMON | VF_VENDOR, API_VERSION); } }; diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index f40451dfa..221c49328 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -83,6 +83,14 @@ class CommandSajoin : public Command return CMD_FAILURE; } } + + RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) + { + User* dest = ServerInstance->FindNick(parameters[0]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; + } }; class ModuleSajoin : public Module @@ -101,7 +109,7 @@ class ModuleSajoin : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("$Id$", VF_OPTCOMMON | VF_VENDOR, API_VERSION); } }; diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index 860f18132..8b94c934c 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -83,6 +83,14 @@ class CommandSakick : public Command return CMD_FAILURE; } + + RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) + { + User* dest = ServerInstance->FindNick(parameters[1]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; + } }; class ModuleSakick : public Module @@ -101,7 +109,7 @@ class ModuleSakick : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON|VF_VENDOR, API_VERSION); + return Version("$Id$", VF_OPTCOMMON|VF_VENDOR, API_VERSION); } }; diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 087f04948..51797892d 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -67,13 +67,18 @@ class CommandSanick : public Command ServerInstance->SNO->WriteToSnoMask('a', oldnick+" failed SANICK (from "+newnick+" to "+parameters[1]+")"); ServerInstance->PI->SendSNONotice("A", oldnick+" failed SANICK (from "+newnick+" to "+parameters[1]+")"); } - /* Yes, hit target and we have sent our NICK out, we can now bail */ - return CMD_LOCALONLY; } - /* No, route it on */ return CMD_SUCCESS; } + + RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) + { + User* dest = ServerInstance->FindNick(parameters[0]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; + } }; @@ -93,7 +98,7 @@ class ModuleSanick : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("$Id$", VF_OPTCOMMON | VF_VENDOR, API_VERSION); } }; diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index a44131129..0c0ac7e13 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -82,6 +82,14 @@ class CommandSapart : public Command return CMD_FAILURE; } + + RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) + { + User* dest = ServerInstance->FindNick(parameters[0]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; + } }; @@ -101,7 +109,7 @@ class ModuleSapart : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("$Id$", VF_OPTCOMMON | VF_VENDOR, API_VERSION); } }; diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 6f0a20f9a..cbd7dfc77 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -44,14 +44,21 @@ class CommandSaquit : public Command ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+parameters[1]); ServerInstance->Users->QuitUser(dest, parameters[1]); - return CMD_LOCALONLY; + return CMD_SUCCESS; } else { user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[0].c_str()); + return CMD_FAILURE; } + } - return CMD_FAILURE; + RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) + { + User* dest = ServerInstance->FindNick(parameters[0]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; } }; @@ -71,7 +78,7 @@ class ModuleSaquit : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("$Id$", VF_OPTCOMMON | VF_VENDOR, API_VERSION); } }; |