summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-06 17:58:59 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-09-06 17:58:59 +0000
commit71ad308979d9c9129507fdf85d4305fd12e18bea (patch)
tree6aaebc6d1fb6e4c49a2adf474bf4592e2d89a5e8
parent4cf0ae1308fe98757de42ffbe391e61844ac9e0a (diff)
All commands now return results CMD_FAILURE or CMD_SUCCESS
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5150 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/command_parse.cpp8
-rw-r--r--src/modules/extra/m_ssl_oper_cert.cpp10
-rw-r--r--src/modules/extra/m_sslinfo.cpp6
-rw-r--r--src/modules/m_cban.cpp5
-rw-r--r--src/modules/m_check.cpp4
-rw-r--r--src/modules/m_chghost.cpp9
-rw-r--r--src/modules/m_chgident.cpp7
-rw-r--r--src/modules/m_devoice.cpp28
-rw-r--r--src/modules/m_globalload.cpp8
-rw-r--r--src/modules/m_globops.cpp4
-rw-r--r--src/modules/m_helpop.cpp8
-rw-r--r--src/modules/m_knock.cpp14
-rw-r--r--src/modules/m_nicklock.cpp17
-rw-r--r--src/modules/m_opermd5.cpp5
-rw-r--r--src/modules/m_opermotd.cpp10
-rw-r--r--src/modules/m_opersha256.cpp7
-rw-r--r--src/modules/m_park.cpp22
-rw-r--r--src/modules/m_randquote.cpp5
-rw-r--r--src/modules/m_remove.cpp18
-rw-r--r--src/modules/m_sajoin.cpp8
-rw-r--r--src/modules/m_samode.cpp6
-rw-r--r--src/modules/m_sanick.cpp12
-rw-r--r--src/modules/m_sapart.cpp12
-rw-r--r--src/modules/m_saquit.cpp8
-rw-r--r--src/modules/m_sethost.cpp13
-rw-r--r--src/modules/m_setident.cpp8
-rw-r--r--src/modules/m_setidle.cpp8
-rw-r--r--src/modules/m_setname.cpp6
-rw-r--r--src/modules/m_silence.cpp12
-rw-r--r--src/modules/m_spy.cpp13
-rw-r--r--src/modules/m_swhois.cpp6
-rw-r--r--src/modules/m_testcommand.cpp6
-rw-r--r--src/modules/m_timedbans.cpp14
-rw-r--r--src/modules/m_tline.cpp6
-rw-r--r--src/modules/m_uninvite.cpp12
-rw-r--r--src/modules/m_userip.cpp7
-rw-r--r--src/modules/m_vhost.cpp5
-rw-r--r--src/modules/m_watch.cpp11
38 files changed, 242 insertions, 126 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 9b5dc5316..4c58d9b60 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -522,13 +522,19 @@ bool CommandParser::ReloadCommand(const char* cmd)
return false;
}
-void cmd_reload::Handle(const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_reload::Handle(const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick, parameters[0]);
if (ServerInstance->Parser->ReloadCommand(parameters[0]))
+ {
user->WriteServ("NOTICE %s :*** Successfully reloaded command '%s'", user->nick, parameters[0]);
+ return CMD_SUCCESS;
+ }
else
+ {
user->WriteServ("NOTICE %s :*** Could not reload command '%s'", user->nick, parameters[0]);
+ return CMD_FAILURE;
+ }
}
void CommandParser::LoadCommand(const char* name)
diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp
index 47b4794d3..2d626e77d 100644
--- a/src/modules/extra/m_ssl_oper_cert.cpp
+++ b/src/modules/extra/m_ssl_oper_cert.cpp
@@ -36,7 +36,7 @@ class cmd_fingerprint : public command_t
syntax = "<nickname>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* target = ServerInstance->FindNick(parameters[0]);
if (target)
@@ -45,18 +45,26 @@ class cmd_fingerprint : public command_t
if (target->GetExt("ssl_cert",cert))
{
if (cert->GetFingerprint().length())
+ {
user->WriteServ("NOTICE %s :Certificate fingerprint for %s is %s",user->nick,target->nick,cert->GetFingerprint().c_str());
+ return CMD_SUCCESS;
+ }
else
+ {
user->WriteServ("NOTICE %s :Certificate fingerprint for %s does not exist!", user->nick,target->nick);
+ return CMD_FAILURE;
+ }
}
else
{
user->WriteServ("NOTICE %s :Certificate fingerprint for %s does not exist!", user->nick, target->nick);
+ return CMD_FAILURE;
}
}
else
{
user->WriteServ("401 %s %s :No such nickname", user->nick, parameters[0]);
+ return CMD_FAILURE;
}
}
};
diff --git a/src/modules/extra/m_sslinfo.cpp b/src/modules/extra/m_sslinfo.cpp
index 5a001ce9e..185e9bf0d 100644
--- a/src/modules/extra/m_sslinfo.cpp
+++ b/src/modules/extra/m_sslinfo.cpp
@@ -36,7 +36,7 @@ class cmd_sslinfo : public command_t
this->syntax = "<nick>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* target = ServerInstance->FindNick(parameters[0]);
ssl_cert* cert;
@@ -52,14 +52,18 @@ class cmd_sslinfo : public command_t
user->WriteServ("NOTICE %s :*** Distinguised Name: %s", user->nick, cert->GetDN().c_str());
user->WriteServ("NOTICE %s :*** Issuer: %s", user->nick, cert->GetIssuer().c_str());
user->WriteServ("NOTICE %s :*** Key Fingerprint: %s", user->nick, cert->GetFingerprint().c_str());
+ return CMD_SUCCESS;
}
else
{
user->WriteServ("NOTICE %s :*** No SSL certificate information for this user.", user->nick);
+ return CMD_FAILURE;
}
}
else
user->WriteServ("401 %s %s :No such nickname", user->nick, parameters[0]);
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 21a3533ec..ff8e3af54 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -59,7 +59,7 @@ class cmd_cban : public command_t
syntax = "<channel> [<duration> :<reason>]";
}
- void Handle(const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle(const char** parameters, int pcnt, userrec *user)
{
/* syntax: CBAN #channel time :reason goes here */
/* 'time' is a human-readable timestring, like 2d3h2s. */
@@ -107,8 +107,11 @@ class cmd_cban : public command_t
else
{
user->WriteServ( "403 %s %s :Invalid channel name", user->nick, parameters[0]);
+ return CMD_FAILURE;
}
}
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index d09793489..4f153d496 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -35,7 +35,7 @@ class cmd_check : public command_t
syntax = "<nickname>|<ip>|<hostmask>|<channel>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec *targuser;
chanrec *targchan;
@@ -175,6 +175,8 @@ class cmd_check : public command_t
}
user->WriteServ(checkstr + " END " + std::string(parameters[0]));
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index fdb438c91..2e8c615db 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -37,7 +37,7 @@ class cmd_chghost : public command_t
syntax = "<nick> <newhost>";
}
- void Handle(const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle(const char** parameters, int pcnt, userrec *user)
{
const char * x = parameters[1];
@@ -48,14 +48,14 @@ class cmd_chghost : public command_t
if (((*x < '0') || (*x > '9')) && (*x != '-'))
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
- return;
+ return CMD_FAILURE;
}
}
}
if ((parameters[1] - x) > 63)
{
user->WriteServ("NOTICE %s :*** CHGHOST: Host too long",user->nick);
- return;
+ return CMD_FAILURE;
}
userrec* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
@@ -65,7 +65,10 @@ class cmd_chghost : public command_t
// fix by brain - ulines set hosts silently
ServerInstance->WriteOpers(std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+parameters[1]);
}
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index a658e1793..1c9e3f6f4 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -17,7 +17,7 @@ class cmd_chgident : public command_t
syntax = "<nick> <newident>";
}
- void Handle(const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle(const char** parameters, int pcnt, userrec *user)
{
userrec* dest = ServerInstance->FindNick(parameters[0]);
@@ -26,16 +26,17 @@ class cmd_chgident : public command_t
if(!ServerInstance->IsIdent(parameters[1]))
{
user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
- return;
+ return CMD_FAILURE;
}
ServerInstance->WriteOpers("%s used CHGIDENT to change %s's ident from '%s' to '%s'", user->nick, dest->nick, dest->ident, parameters[1]);
dest->ChangeIdent(parameters[1]);
- //strlcpy(dest->ident, parameters[1], IDENTMAX+2);
+ return CMD_SUCCESS;
}
else
{
user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
+ return CMD_FAILURE;
}
}
};
diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp
index 4dcca3d9d..fb5b4bc83 100644
--- a/src/modules/m_devoice.cpp
+++ b/src/modules/m_devoice.cpp
@@ -34,26 +34,28 @@ using namespace std;
class cmd_devoice : public command_t
{
public:
- cmd_devoice (InspIRCd* Instance) : command_t(Instance,"DEVOICE", 0, 1)
+ cmd_devoice (InspIRCd* Instance) : command_t(Instance,"DEVOICE", 0, 1)
{
this->source = "m_devoice.so";
syntax = "<channel>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
- /*
- * NOTE: DO NOT CODE LIKE THIS!!! This has no checks and can send
- * invalid or plain confusing mode changes, code some checking!
- *
- * - I'm not aware what checking I need, so for now... be supreme evil.
- */
- const char* modes[3];
- modes[0] = parameters[0];
- modes[1] = "-v";
- modes[2] = user->nick;
+ chanrec* c = ServerInstance->FindChan(parameters[0]);
+ if (c && c->HasUser(user))
+ {
+ const char* modes[3];
+ modes[0] = parameters[0];
+ modes[1] = "-v";
+ modes[2] = user->nick;
- ServerInstance->SendMode(modes,3,user);
+ ServerInstance->SendMode(modes,3,user);
+
+ return CMD_SUCCESS;
+ }
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp
index dfd518cf2..e65f90b64 100644
--- a/src/modules/m_globalload.cpp
+++ b/src/modules/m_globalload.cpp
@@ -34,16 +34,18 @@ class cmd_gloadmodule : public command_t
syntax = "<modulename>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
if (ServerInstance->LoadModule(parameters[0]))
{
ServerInstance->WriteOpers("*** NEW MODULE '%s' GLOBALLY LOADED BY '%s'",parameters[0],user->nick);
user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
+ return CMD_SUCCESS;
}
else
{
user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ return CMD_FAILURE;
}
}
};
@@ -57,16 +59,18 @@ class cmd_gunloadmodule : public command_t
syntax = "<modulename>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
if (ServerInstance->UnloadModule(parameters[0]))
{
ServerInstance->WriteOpers("*** MODULE '%s' GLOBALLY UNLOADED BY '%s'",parameters[0],user->nick);
user->WriteServ("973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
+ return CMD_SUCCESS;
}
else
{
user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ return CMD_FAILURE;
}
}
};
diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp
index 9e55fdf71..5cd17841d 100644
--- a/src/modules/m_globops.cpp
+++ b/src/modules/m_globops.cpp
@@ -38,7 +38,7 @@ class cmd_globops : public command_t
syntax = "<any-text>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
std::string line = "From " + std::string(user->nick) + ": ";
for (int i = 0; i < pcnt; i++)
@@ -46,6 +46,8 @@ class cmd_globops : public command_t
line = line + std::string(parameters[i]) + " ";
}
ServerInstance->SNO->WriteToSnoMask('g',line);
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index 89ad243b6..dc124cd46 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -69,18 +69,18 @@ class cmd_helpop : public command_t
syntax = "[?|!]<any-text>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
char a[MAXBUF];
std::string output = " ";
if (!helpop)
- return;
+ return CMD_FAILURE;
if (pcnt < 1)
{
do_helpop(NULL,pcnt,user);
- return;
+ return CMD_SUCCESS;
}
if (*parameters[0] == '!')
@@ -126,6 +126,8 @@ class cmd_helpop : public command_t
sendtohelpop(user, pcnt, parameters);
}
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 68bcde9a2..3a104bb67 100644
--- a/src/modules/m_knock.cpp
+++ b/src/modules/m_knock.cpp
@@ -31,20 +31,20 @@ using namespace std;
class cmd_knock : public command_t
{
public:
- cmd_knock (InspIRCd* Instance) : command_t(Instance,"KNOCK", 0, 2)
+ cmd_knock (InspIRCd* Instance) : command_t(Instance,"KNOCK", 0, 2)
{
this->source = "m_knock.so";
syntax = "<channel> <reason>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
chanrec* c = ServerInstance->FindChan(parameters[0]);
if (!c)
{
user->WriteServ("401 %s %s :No such channel",user->nick, parameters[0]);
- return;
+ return CMD_FAILURE;
}
std::string line = "";
@@ -52,7 +52,7 @@ class cmd_knock : public command_t
if (c->IsModeSet('K'))
{
user->WriteServ("480 %s :Can't KNOCK on %s, +K is set.",user->nick, c->name);
- return;
+ return CMD_FAILURE;
}
for (int i = 1; i < pcnt - 1; i++)
@@ -65,13 +65,15 @@ class cmd_knock : public command_t
{
c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str());
user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick,c->name);
- return;
+ return CMD_SUCCESS;
}
else
{
user->WriteServ("480 %s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name);
- return;
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index 1a7e8c5a7..d44cc29ac 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -39,7 +39,7 @@ class cmd_nicklock : public command_t
syntax = "<oldnick> <newnick>";
}
- void Handle(const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle(const char** parameters, int pcnt, userrec *user)
{
userrec* source = ServerInstance->FindNick(parameters[0]);
irc::string server;
@@ -50,7 +50,7 @@ class cmd_nicklock : public command_t
if (source->GetExt("nick_locked", dummy))
{
user->WriteServ("946 %s %s :This user's nickname is already locked.",user->nick,source->nick);
- return;
+ return CMD_FAILURE;
}
if (ServerInstance->IsNick(parameters[1]))
{
@@ -59,11 +59,17 @@ class cmd_nicklock : public command_t
if (!source->ForceNickChange(parameters[1]))
{
userrec::QuitUser(ServerInstance, source, "Nickname collision");
- return;
+ return CMD_FAILURE;
}
source->Extend("nick_locked", "ON");
+
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
+
+ return CMD_FAILURE;
}
};
@@ -76,7 +82,7 @@ class cmd_nickunlock : public command_t
syntax = "<locked-nick>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* source = ServerInstance->FindNick(parameters[0]);
if (source)
@@ -84,7 +90,10 @@ class cmd_nickunlock : public command_t
source->Shrink("nick_locked");
user->WriteServ("945 %s %s :Nickname now unlocked.",user->nick,source->nick);
ServerInstance->WriteOpers(std::string(user->nick)+" used NICKUNLOCK on "+parameters[0]);
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp
index e6fd8023b..723513de8 100644
--- a/src/modules/m_opermd5.cpp
+++ b/src/modules/m_opermd5.cpp
@@ -272,17 +272,18 @@ void GenHash(const char* src, char* dest)
class cmd_mkpasswd : public command_t
{
public:
- cmd_mkpasswd (InspIRCd* Instance) : command_t(Instance,"MKPASSWD", 'o', 1)
+ cmd_mkpasswd (InspIRCd* Instance) : command_t(Instance,"MKPASSWD", 'o', 1)
{
this->source = "m_opermd5.so";
syntax = "<any-text>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
char buffer[MAXBUF];
GenHash(parameters[0],buffer);
user->WriteServ("NOTICE %s :MD5 hashed password for %s is %s",user->nick,parameters[0],buffer);
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index 5d50d4192..2ab3e7dee 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -13,12 +13,12 @@ using namespace std;
static FileReader* opermotd;
-void ShowOperMOTD(userrec* user)
+CmdResult ShowOperMOTD(userrec* user)
{
if(!opermotd->FileSize())
{
user->WriteServ(std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing"));
- return;
+ return CMD_FAILURE;
}
user->WriteServ(std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day"));
for(int i=0; i != opermotd->FileSize(); i++)
@@ -26,6 +26,8 @@ void ShowOperMOTD(userrec* user)
user->WriteServ(std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i));
}
user->WriteServ(std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD"));
+
+ return CMD_SUCCESS;
}
class cmd_opermotd : public command_t
@@ -37,9 +39,9 @@ class cmd_opermotd : public command_t
syntax = "[<servername>]";
}
- void Handle (const char** parameters, int pcnt, userrec* user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec* user)
{
- ShowOperMOTD(user);
+ return ShowOperMOTD(user);
}
};
diff --git a/src/modules/m_opersha256.cpp b/src/modules/m_opersha256.cpp
index 92579cdaf..40fa3e949 100644
--- a/src/modules/m_opersha256.cpp
+++ b/src/modules/m_opersha256.cpp
@@ -228,17 +228,18 @@ void SHA256(const char *src, char *dest, int len)
class cmd_mksha256 : public command_t
{
public:
- cmd_mksha256 (InspIRCd* Instance) : command_t(Instance,"MKSHA256", 'o', 1)
+ cmd_mksha256 (InspIRCd* Instance) : command_t(Instance,"MKSHA256", 'o', 1)
{
this->source = "m_opersha256.so";
syntax = "<any-text>";
}
- void Handle(const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle(const char** parameters, int pcnt, userrec *user)
{
char buffer[SHA256_BLOCK_SIZE + 1];
SHA256(parameters[0], buffer, strlen(parameters[0]));
- user->WriteServ( "NOTICE %s :SHA256 hashed password for %s is %s", user->nick, parameters[0], buffer);
+ user->WriteServ("NOTICE %s :SHA256 hashed password for %s is %s", user->nick, parameters[0], buffer);
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp
index c1c8a055b..de8eeb25e 100644
--- a/src/modules/m_park.cpp
+++ b/src/modules/m_park.cpp
@@ -61,12 +61,12 @@ parkedinfo pi;
class cmd_park : public command_t
{
public:
- cmd_park (InspIRCd* Instance) : command_t(Instance,"PARK", 0, 0)
+ cmd_park (InspIRCd* Instance) : command_t(Instance,"PARK", 0, 0)
{
this->source = "m_park.so";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
/** Parking. easy stuff.
*
@@ -82,6 +82,7 @@ class cmd_park : public command_t
if (othersessions >= ConcurrentParks)
{
user->WriteServ("927 "+std::string(user->nick)+" :You are already parked up to the maximum number of allowed times.");
+ return CMD_FAILURE;
}
else
{
@@ -98,6 +99,7 @@ class cmd_park : public command_t
pi.host = user->host;
pi.parktime = time(NULL);
pinfo.push_back(pi);
+ return CMD_SUCCESS;
}
}
@@ -106,29 +108,30 @@ class cmd_park : public command_t
class cmd_parkstats : public command_t
{
public:
- cmd_parkstats (InspIRCd* Instance) : command_t(Instance,"PARKSTATS", 'o', 0)
+ cmd_parkstats (InspIRCd* Instance) : command_t(Instance,"PARKSTATS", 'o', 0)
{
this->source = "m_park.so";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
char status[MAXBUF];
snprintf(status,MAXBUF,"NOTICE %s :There are a total of %lu parked clients on this server, with a maximum of %lu parked sessions allowed per user.",user->nick,(unsigned long)pinfo.size(),(unsigned long)ConcurrentParks);
user->WriteServ(std::string(status));
+ return CMD_SUCCESS;
}
};
class cmd_unpark : public command_t
{
public:
- cmd_unpark (InspIRCd* Instance) : command_t(Instance,"UNPARK", 0, 2)
+ cmd_unpark (InspIRCd* Instance) : command_t(Instance,"UNPARK", 0, 2)
{
this->source = "m_park.so";
syntax = "<nick> <key>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
/** Unparking. complicated stuff.
*
@@ -150,7 +153,7 @@ class cmd_unpark : public command_t
if (!unpark)
{
user->WriteServ("942 %s %s :Invalid user specified.",user->nick, parameters[0]);
- return;
+ return CMD_FAILURE;
}
awaylog* awy;
unpark->GetExt("park_awaylog", awy);
@@ -159,7 +162,7 @@ class cmd_unpark : public command_t
if (!awy)
{
user->WriteServ("943 %s %s :This user is not parked.",user->nick, unpark->nick);
- return;
+ return CMD_FAILURE;
}
if (*key == atoi(parameters[1]))
{
@@ -205,7 +208,10 @@ class cmd_unpark : public command_t
else
{
user->WriteServ("928 "+std::string(user->nick)+" :Incorrect park key.");
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 0bb0be1db..46af34f63 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -39,7 +39,7 @@ class cmd_randquote : public command_t
this->source = "m_randquote.so";
}
- void Handle (const char** parameters, int pcntl, userrec *user)
+ CmdResult Handle (const char** parameters, int pcntl, userrec *user)
{
std::string str;
int fsize;
@@ -55,8 +55,9 @@ class cmd_randquote : public command_t
{
sprintf(buf, "NOTICE %s :Your administrator specified an invalid quotes file, please bug them about this.", user->nick);
user->WriteServ(std::string(buf));
+ return CMD_FAILURE;
}
- return;
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 95c454347..36f056451 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -77,7 +77,7 @@ class RemoveBase
}
}
- void Handle (const char** parameters, int pcnt, userrec *user, bool neworder)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user, bool neworder)
{
const char* channame;
const char* username;
@@ -108,13 +108,13 @@ class RemoveBase
if (!target || !channel)
{
user->WriteServ("401 %s %s :No such nick/channel", user->nick, !target ? username : channame);
- return;
+ return CMD_FAILURE;
}
if (!channel->HasUser(target))
{
user->WriteServ( "NOTICE %s :*** The user %s is not on channel %s", user->nick, target->nick, channel->name);
- return;
+ return CMD_FAILURE;
}
/* This is adding support for the +q and +a channel modes, basically if they are enabled, and the remover has them set.
@@ -206,13 +206,17 @@ class RemoveBase
else
{
user->WriteServ( "NOTICE %s :*** You do not have access to /remove %s from %s", user->nick, target->nick, channel->name);
+ return CMD_FAILURE;
}
}
else
{
/* m_nokicks.so was loaded and +Q was set, block! */
user->WriteServ( "484 %s %s :Can't remove user %s from channel (+Q set)", user->nick, channel->name, target->nick);
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
};
@@ -225,9 +229,9 @@ class cmd_remove : public command_t, public RemoveBase
syntax = "<nick> <channel> [<reason>]";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
- RemoveBase::Handle(parameters, pcnt, user, false);
+ return RemoveBase::Handle(parameters, pcnt, user, false);
}
};
@@ -240,9 +244,9 @@ class cmd_fpart : public command_t, public RemoveBase
syntax = "<channel> <nick> [<reason>]";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
- RemoveBase::Handle(parameters, pcnt, user, true);
+ return RemoveBase::Handle(parameters, pcnt, user, true);
}
};
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 01a335f80..2fe790b6f 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -38,7 +38,7 @@ class cmd_sajoin : public command_t
syntax = "<nick> <channel>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
@@ -46,18 +46,20 @@ class cmd_sajoin : public command_t
if (ServerInstance->ULine(dest->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
- return;
+ return CMD_FAILURE;
}
if (!ServerInstance->IsChannel(parameters[1]))
{
/* we didn't need to check this for each character ;) */
user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
- return;
+ return CMD_FAILURE;
}
ServerInstance->WriteOpers(std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]);
chanrec::JoinUser(ServerInstance, dest, parameters[1], true);
}
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 2453308d3..95c13f69a 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -43,13 +43,13 @@ using namespace std;
class cmd_samode : public command_t
{
public:
- cmd_samode (InspIRCd* Instance) : command_t(Instance,"SAMODE", 'o', 2)
+ cmd_samode (InspIRCd* Instance) : command_t(Instance,"SAMODE", 'o', 2)
{
this->source = "m_samode.so";
syntax = "<target> <modes> {<mode-parameters>}";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
/*
* Handles an SAMODE request. Notifies all +s users.
@@ -69,6 +69,8 @@ class cmd_samode : public command_t
result.append(parameters[n]);
}
ServerInstance->WriteOpers(result);
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index 818672ce4..bbecfb9cf 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -37,7 +37,7 @@ class cmd_sanick : public command_t
syntax = "<nick> <new-nick>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* source = ServerInstance->FindNick(parameters[0]);
if (source)
@@ -45,7 +45,7 @@ class cmd_sanick : public command_t
if (ServerInstance->ULine(source->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
- return;
+ return CMD_FAILURE;
}
if (ServerInstance->IsNick(parameters[1]))
{
@@ -56,10 +56,16 @@ class cmd_sanick : public command_t
{
/* We couldnt change the nick */
userrec::QuitUser(ServerInstance, source, "Nickname collision");
- return;
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 98178c46a..36078ab06 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -32,13 +32,13 @@ using namespace std;
class cmd_sapart : public command_t
{
public:
- cmd_sapart (InspIRCd* Instance) : command_t(Instance,"SAPART", 'o', 2)
+ cmd_sapart (InspIRCd* Instance) : command_t(Instance,"SAPART", 'o', 2)
{
this->source = "m_sapart.so";
syntax = "<nick> <channel>";
}
-
- void Handle (const char** parameters, int pcnt, userrec *user)
+
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* dest = ServerInstance->FindNick(parameters[0]);
chanrec* channel = ServerInstance->FindChan(parameters[1]);
@@ -47,12 +47,16 @@ class cmd_sapart : public command_t
if (ServerInstance->ULine(dest->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
- return;
+ return CMD_FAILURE;
}
ServerInstance->WriteOpers(std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]);
if (!channel->PartUser(dest, dest->nick))
delete channel;
+
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index 1152a2ea2..615ba5934 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -47,7 +47,7 @@ class cmd_saquit : public command_t
syntax = "<nick> <reason>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
@@ -55,7 +55,7 @@ class cmd_saquit : public command_t
if (ServerInstance->ULine(dest->server))
{
user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick);
- return;
+ return CMD_FAILURE;
}
std::string line = "";
for (int i = 1; i < pcnt - 1; i++)
@@ -66,7 +66,11 @@ class cmd_saquit : public command_t
ServerInstance->WriteOpers(std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+line);
userrec::QuitUser(ServerInstance, dest, line);
+
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index b7496a4ba..296c0788a 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -32,18 +32,18 @@ using namespace std;
class cmd_sethost : public command_t
{
public:
- cmd_sethost (InspIRCd* Instance) : command_t(Instance,"SETHOST",'o',1)
+ cmd_sethost (InspIRCd* Instance) : command_t(Instance,"SETHOST",'o',1)
{
this->source = "m_sethost.so";
syntax = "<new-hostname>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
if (strlen(parameters[0]) > 64)
{
user->WriteServ("NOTICE %s :*** SETHOST: Host too long",user->nick);
- return;
+ return CMD_FAILURE;
}
for (unsigned int x = 0; x < strlen(parameters[0]); x++)
{
@@ -52,12 +52,17 @@ class cmd_sethost : public command_t
if (((parameters[0][x] < '0') || (parameters[0][x]> '9')) && (parameters[0][x] != '-'))
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
- return;
+ return CMD_FAILURE;
}
}
}
if (user->ChangeDisplayedHost(parameters[0]))
+ {
ServerInstance->WriteOpers(std::string(user->nick)+" used SETHOST to change their displayed host to "+std::string(parameters[0]));
+ return CMD_SUCCESS;
+ }
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index 94ab3ff51..c3b24aeb4 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -17,7 +17,7 @@ class cmd_setident : public command_t
syntax = "<new-ident>";
}
- void Handle(const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle(const char** parameters, int pcnt, userrec *user)
{
for(unsigned int x = 0; x < strlen(parameters[0]); x++)
{
@@ -25,11 +25,13 @@ class cmd_setident : public command_t
continue;
user->WriteServ("NOTICE %s :*** Invalid characters in ident", user->nick);
- return;
+ return CMD_FAILURE;
}
ServerInstance->WriteOpers("%s used SETIDENT to change their ident from '%s' to '%s'", user->nick, user->ident, parameters[0]);
- strlcpy(user->ident, parameters[0], IDENTMAX+2);
+ user->ChangeIdent(parameters[0]);
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index f6584aef6..07144f167 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -31,18 +31,18 @@ using namespace std;
class cmd_setidle : public command_t
{
public:
- cmd_setidle (InspIRCd* Instance) : command_t(Instance,"SETIDLE", 'o', 1)
+ cmd_setidle (InspIRCd* Instance) : command_t(Instance,"SETIDLE", 'o', 1)
{
this->source = "m_setidle.so";
syntax = "<idle-seconds>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
if (atoi(parameters[0]) < 1)
{
user->WriteServ("948 %s :Invalid idle time.",user->nick);
- return;
+ return CMD_FAILURE;
}
user->idle_lastmsg = time(NULL) - atoi(parameters[0]);
// minor tweak - we cant have signon time shorter than our idle time!
@@ -50,6 +50,8 @@ class cmd_setidle : public command_t
user->signon = user->idle_lastmsg;
ServerInstance->WriteOpers(std::string(user->nick)+" used SETIDLE to set their idle time to "+std::string(parameters[0])+" seconds");
user->WriteServ("944 %s :Idle time set.",user->nick);
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index 25269d1c4..b590bdcdc 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -31,13 +31,13 @@ using namespace std;
class cmd_setname : public command_t
{
public:
- cmd_setname (InspIRCd* Instance) : command_t(Instance,"SETNAME", 0, 1)
+ cmd_setname (InspIRCd* Instance) : command_t(Instance,"SETNAME", 0, 1)
{
this->source = "m_setname.so";
syntax = "<new-gecos>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
std::string line = "";
for (int i = 0; i < pcnt-1; i++)
@@ -46,6 +46,8 @@ class cmd_setname : public command_t
}
line = line + std::string(parameters[pcnt-1]);
user->ChangeName(line.c_str());
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 7f8b49287..bbb3d79ac 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -37,13 +37,13 @@ typedef std::vector<std::string> silencelist;
class cmd_silence : public command_t
{
public:
- cmd_silence (InspIRCd* Instance) : command_t(Instance,"SILENCE", 0, 0)
+ cmd_silence (InspIRCd* Instance) : command_t(Instance,"SILENCE", 0, 0)
{
this->source = "m_silence.so";
syntax = "{[+|-]<mask>}";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
if (!pcnt)
{
@@ -60,6 +60,8 @@ class cmd_silence : public command_t
}
}
user->WriteServ("272 %s :End of Silence List",user->nick);
+
+ return CMD_SUCCESS;
}
else if (pcnt > 0)
{
@@ -123,15 +125,15 @@ class cmd_silence : public command_t
if (listitem == mask)
{
user->WriteServ("952 %s %s :%s is already on your silence list",user->nick, user->nick, mask.c_str());
- return;
+ return CMD_SUCCESS;
}
}
sl->push_back(mask);
user->WriteServ("951 %s %s :Added %s to silence list",user->nick, user->nick, mask.c_str());
- return;
+ return CMD_SUCCESS;
}
}
- return;
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp
index bcf2a25ac..8d69fffd6 100644
--- a/src/modules/m_spy.cpp
+++ b/src/modules/m_spy.cpp
@@ -71,7 +71,7 @@ class cmd_spylist : public command_t
syntax = "";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
ServerInstance->WriteOpers("*** Oper %s used SPYLIST to list +s/+p channels and keys.",user->nick);
user->WriteServ("321 %s Channel :Users Name",user->nick);
@@ -82,6 +82,9 @@ class cmd_spylist : public command_t
user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,i->second->GetUserCounter(),i->second->ChanModes(true),i->second->topic);
}
user->WriteServ("323 %s :End of channel list.",user->nick);
+
+ /* Dont send out across the network */
+ return CMD_FAILURE;
}
};
@@ -94,18 +97,18 @@ class cmd_spynames : public command_t
syntax = "{<channel>{,<channel>}}";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
chanrec* c;
if (!pcnt)
{
user->WriteServ("366 %s * :End of /NAMES list.",user->nick);
- return;
+ return CMD_FAILURE;
}
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 1))
- return;
+ return CMD_FAILURE;
ServerInstance->WriteOpers("*** Oper %s used SPYNAMES to view the users on %s",user->nick,parameters[0]);
@@ -119,6 +122,8 @@ class cmd_spynames : public command_t
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 3103e7a56..4b62db699 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -34,7 +34,7 @@ class cmd_swhois : public command_t
syntax = "<nick> <swhois>";
}
- void Handle(const char** parameters, int pcnt, userrec* user)
+ CmdResult Handle(const char** parameters, int pcnt, userrec* user)
{
userrec* dest = ServerInstance->FindNick(parameters[0]);
if(dest)
@@ -70,7 +70,11 @@ class cmd_swhois : public command_t
text = new std::string(line);
dest->Extend("swhois", text);
+
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp
index 86601e953..bc268c34b 100644
--- a/src/modules/m_testcommand.cpp
+++ b/src/modules/m_testcommand.cpp
@@ -53,12 +53,12 @@ class MyV6Resolver : public Resolver
class cmd_woot : public command_t
{
public:
- cmd_woot (InspIRCd* Instance) : command_t(Instance,"WOOT", 0, 0)
+ cmd_woot (InspIRCd* Instance) : command_t(Instance,"WOOT", 0, 0)
{
this->source = "m_testcommand.so";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
/* We dont have to worry about deleting 'r', the core will
* do it for us as required.*/
@@ -74,6 +74,8 @@ class cmd_woot : public command_t
{
ServerInstance->Log(DEBUG,"Danger, will robinson! There was an exception: %s",e.GetReason());
}
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 08da114a6..24b508372 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -51,7 +51,7 @@ class cmd_tban : public command_t
syntax = "<channel> <duration> <banmask>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
chanrec* channel = ServerInstance->FindChan(parameters[0]);
if (channel)
@@ -62,12 +62,12 @@ class cmd_tban : public command_t
if (!ServerInstance->IsValidMask(parameters[2]))
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban mask");
- return;
+ return CMD_FAILURE;
}
if (channel->IsBanned(user))
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :The ban "+std::string(parameters[2])+" is already on the banlist of "+std::string(parameters[0]));
- return;
+ return CMD_FAILURE;
}
TimedBan T;
std::string channelname = parameters[0];
@@ -75,7 +75,7 @@ class cmd_tban : public command_t
if (ServerInstance->Duration(parameters[1]) < 1)
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid ban time");
- return;
+ return CMD_FAILURE;
}
char duration[MAXBUF];
snprintf(duration,MAXBUF,"%lu",ServerInstance->Duration(parameters[1]));
@@ -99,13 +99,15 @@ class cmd_tban : public command_t
T.expire = expire;
TimedBanList.push_back(T);
channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s added a timed ban on %s lasting for %s seconds.", channel->name, user->nick, mask.c_str(), duration);
+ return CMD_SUCCESS;
}
- return;
+ return CMD_FAILURE;
}
else user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, channel->name);
- return;
+ return CMD_FAILURE;
}
user->WriteServ("401 %s %s :No such channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp
index 031b89de1..ccb560428 100644
--- a/src/modules/m_tline.cpp
+++ b/src/modules/m_tline.cpp
@@ -33,13 +33,13 @@ using namespace std;
class cmd_tline : public command_t
{
public:
- cmd_tline (InspIRCd* Instance) : command_t(Instance,"TLINE", 'o', 1)
+ cmd_tline (InspIRCd* Instance) : command_t(Instance,"TLINE", 'o', 1)
{
this->source = "m_tline.so";
this->syntax = "<mask>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
float n_counted = 0;
float n_matched = 0;
@@ -69,6 +69,8 @@ class cmd_tline : public command_t
user->WriteServ( "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against %0.0f user(s) (%0.2f%% of the userbase). %0.0f by hostname and %0.0f by IP address.",user->nick, n_counted, parameters[0], n_matched, (n_counted/n_matched)*100, n_match_host, n_match_ip);
else
user->WriteServ( "NOTICE %s :*** TLINE: Counted %0.0f user(s). Matched '%s' against no user(s).", user->nick, n_counted, parameters[0]);
+
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index 88d8f4707..b967b3496 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -38,7 +38,7 @@ class cmd_uninvite : public command_t
syntax = "<nick> <channel>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
userrec* u = ServerInstance->FindNick(parameters[0]);
chanrec* c = ServerInstance->FindChan(parameters[1]);
@@ -54,7 +54,7 @@ class cmd_uninvite : public command_t
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
- return;
+ return CMD_FAILURE;
}
if (c->modes[CM_INVITEONLY])
@@ -62,7 +62,7 @@ class cmd_uninvite : public command_t
if (c->GetStatus(user) < STATUS_HOP)
{
user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, c->name);
- return;
+ return CMD_FAILURE;
}
}
@@ -71,18 +71,20 @@ class cmd_uninvite : public command_t
if (!u->IsInvited(xname))
{
user->WriteServ("491 %s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name);
- return;
+ return CMD_FAILURE;
}
if (!c->HasUser(user))
{
user->WriteServ("492 %s %s :You're not on that channel!",user->nick, c->name);
- return;
+ return CMD_FAILURE;
}
u->RemoveInvite(xname);
user->WriteServ("494 %s %s %s :Uninvited",user->nick,c->name,u->nick);
u->WriteServ("493 %s :You were uninvited from %s by %s",u->nick,c->name,user->nick);
c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.", c->name, user->nick, u->nick);
+
+ return CMD_SUCCESS;
}
};
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp
index 341a66615..033bb0ada 100644
--- a/src/modules/m_userip.cpp
+++ b/src/modules/m_userip.cpp
@@ -32,13 +32,13 @@ using namespace std;
class cmd_userip : public command_t
{
public:
- cmd_userip (InspIRCd* Instance) : command_t(Instance,"USERIP", 'o', 1)
+ cmd_userip (InspIRCd* Instance) : command_t(Instance,"USERIP", 'o', 1)
{
this->source = "m_userip.so";
syntax = "<nick>{,<nick>}";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
char Return[MAXBUF],junk[MAXBUF];
snprintf(Return,MAXBUF,"340 %s :",user->nick);
@@ -52,6 +52,9 @@ class cmd_userip : public command_t
}
}
user->WriteServ(Return);
+
+ /* Dont send to the network */
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp
index f0ebfe54b..eb6c3e38e 100644
--- a/src/modules/m_vhost.cpp
+++ b/src/modules/m_vhost.cpp
@@ -36,7 +36,7 @@ class cmd_vhost : public command_t
syntax = "<username> <password>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
for (int index = 0; index < Conf->Enumerate("vhost"); index++)
{
@@ -49,11 +49,12 @@ class cmd_vhost : public command_t
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
user->ChangeDisplayedHost(mask.c_str());
- return;
+ return CMD_FAILURE;
}
}
}
user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
+ return CMD_FAILURE;
}
};
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index a8b50d025..09dc8d384 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -44,13 +44,13 @@ watchlist watches;
class cmd_watch : public command_t
{
public:
- cmd_watch (InspIRCd* Instance) : command_t(Instance,"WATCH",0,0)
+ cmd_watch (InspIRCd* Instance) : command_t(Instance,"WATCH",0,0)
{
this->source = "m_watch.so";
syntax = "[C|L|S]|[+|-<nick>]";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
if (!pcnt)
{
@@ -133,7 +133,7 @@ class cmd_watch : public command_t
if (!ServerInstance->IsNick(nick))
{
user->WriteServ("942 %s %s :Invalid nickname",user->nick,nick);
- return;
+ return CMD_FAILURE;
}
irc::string n1 = nick;
for (watchlist::iterator q = watches.begin(); q != watches.end(); q++)
@@ -166,7 +166,7 @@ class cmd_watch : public command_t
if (!ServerInstance->IsNick(nick))
{
user->WriteServ("942 %s %s :Invalid nickname",user->nick,nick);
- return;
+ return CMD_FAILURE;
}
irc::string n1 = nick;
bool exists = false;
@@ -203,7 +203,8 @@ class cmd_watch : public command_t
}
}
}
- return;
+ /* So that spanningtree doesnt pass the WATCH commands to the network! */
+ return CMD_FAILURE;
}
};