summaryrefslogtreecommitdiff
path: root/src/modules/m_sapart.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 18:23:50 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-16 18:23:50 +0000
commitab9d8fd1af3ebf028506ec543f74fd13471742dd (patch)
treed95fd9303718109daa304bd602dc69af1ebb1b05 /src/modules/m_sapart.cpp
parent293df6a8b55e89c127e60e92711ef0ef1027bff8 (diff)
Porting to new command system
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2535 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_sapart.cpp')
-rw-r--r--src/modules/m_sapart.cpp41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 21e2f7fbe..026a3bd7d 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -25,35 +25,46 @@ using namespace std;
/* $ModDesc: Provides support for unreal-style SAPART command */
Server *Srv;
-
-void handle_sapart(char **parameters, int pcnt, userrec *user)
+
+class cmd_sapart : public command_t
{
- userrec* dest = Srv->FindNick(std::string(parameters[0]));
- if (dest)
+ public:
+ cmd_sapart () : command_t("SAPART", 'o', 2)
+ {
+ this->source = "m_sapart.so";
+ }
+
+ void Handle (char **parameters, int pcnt, userrec *user)
{
- for (unsigned int x = 0; x < strlen(parameters[1]); x++)
+ userrec* dest = Srv->FindNick(std::string(parameters[0]));
+ if (dest)
{
- if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
- {
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
- return;
- }
- }
+ for (unsigned int x = 0; x < strlen(parameters[1]); x++)
+ {
+ if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
+ {
+ Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+ return;
+ }
+ }
- Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+std::string(dest->nick)+" part "+parameters[1]);
- Srv->PartUserFromChannel(dest,std::string(parameters[1]),std::string(dest->nick));
+ Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+std::string(dest->nick)+" part "+parameters[1]);
+ Srv->PartUserFromChannel(dest,std::string(parameters[1]),std::string(dest->nick));
+ }
}
-}
+};
class ModuleSapart : public Module
{
+ cmd_sapart* mycommand;
public:
ModuleSapart(Server* Me)
: Module::Module(Me)
{
Srv = Me;
- Srv->AddCommand("SAPART",handle_sapart,'o',2,"m_sapart.so");
+ mycommand = new cmd_sapart();
+ Srv->AddCommand(mycommand);
}
virtual ~ModuleSapart()