summaryrefslogtreecommitdiff
path: root/src/modules/m_remove.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:52:28 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 00:52:28 +0000
commitfc4d8fc4cc409770c0488c7b56f1b140dcbd2397 (patch)
tree6f360605185e2ed6fb61b0cec55b4947e32d0c3c /src/modules/m_remove.cpp
parent68174076d7d665340ca992f88013dc2e6035a0a8 (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/m_remove.cpp')
-rw-r--r--src/modules/m_remove.cpp43
1 files changed, 30 insertions, 13 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);
}
};