summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd_admin.cpp3
-rw-r--r--src/cmd_away.cpp3
-rw-r--r--src/cmd_commands.cpp3
-rw-r--r--src/cmd_connect.cpp3
-rw-r--r--src/cmd_die.cpp4
-rw-r--r--src/cmd_eline.cpp8
-rw-r--r--src/cmd_gline.cpp9
-rw-r--r--src/cmd_info.cpp3
-rw-r--r--src/cmd_invite.cpp14
-rw-r--r--src/cmd_ison.cpp7
-rw-r--r--src/cmd_join.cpp11
-rw-r--r--src/cmd_kick.cpp8
-rw-r--r--src/cmd_kill.cpp7
-rw-r--r--src/cmd_kline.cpp8
-rw-r--r--src/cmd_links.cpp3
-rw-r--r--src/cmd_list.cpp4
-rw-r--r--src/cmd_loadmodule.cpp5
-rw-r--r--src/cmd_lusers.cpp4
-rw-r--r--src/cmd_map.cpp4
-rw-r--r--src/cmd_mode.cpp8
-rw-r--r--src/cmd_modules.cpp4
-rw-r--r--src/cmd_motd.cpp3
-rw-r--r--src/cmd_names.cpp10
-rw-r--r--src/cmd_nick.cpp59
-rw-r--r--src/cmd_notice.cpp26
-rw-r--r--src/cmd_oper.cpp8
-rw-r--r--src/cmd_part.cpp7
-rw-r--r--src/cmd_pass.cpp6
-rw-r--r--src/cmd_ping.cpp3
-rw-r--r--src/cmd_pong.cpp3
-rw-r--r--src/cmd_privmsg.cpp24
-rw-r--r--src/cmd_qline.cpp8
-rw-r--r--src/cmd_quit.cpp4
-rw-r--r--src/cmd_rehash.cpp5
-rw-r--r--src/cmd_restart.cpp6
-rw-r--r--src/cmd_rules.cpp3
-rw-r--r--src/cmd_server.cpp3
-rw-r--r--src/cmd_squit.cpp3
-rw-r--r--src/cmd_stats.cpp4
-rw-r--r--src/cmd_summon.cpp3
-rw-r--r--src/cmd_time.cpp5
-rw-r--r--src/cmd_topic.cpp15
-rw-r--r--src/cmd_trace.cpp3
-rw-r--r--src/cmd_unloadmodule.cpp5
-rw-r--r--src/cmd_user.cpp8
-rw-r--r--src/cmd_userhost.cpp4
-rw-r--r--src/cmd_users.cpp3
-rw-r--r--src/cmd_version.cpp4
-rw-r--r--src/cmd_wallops.cpp3
-rw-r--r--src/cmd_who.cpp4
-rw-r--r--src/cmd_whois.cpp7
-rw-r--r--src/cmd_whowas.cpp6
-rw-r--r--src/cmd_zline.cpp11
-rw-r--r--src/modules/m_spanningtree.cpp6
54 files changed, 249 insertions, 146 deletions
diff --git a/src/cmd_admin.cpp b/src/cmd_admin.cpp
index 86072a5ed..5b04bafb7 100644
--- a/src/cmd_admin.cpp
+++ b/src/cmd_admin.cpp
@@ -25,10 +25,11 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_admin(Instance);
}
-void cmd_admin::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_admin::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("256 %s :Administrative info for %s",user->nick,ServerInstance->Config->ServerName);
user->WriteServ("257 %s :Name - %s",user->nick,ServerInstance->Config->AdminName);
user->WriteServ("258 %s :Nickname - %s",user->nick,ServerInstance->Config->AdminNick);
user->WriteServ("258 %s :E-Mail - %s",user->nick,ServerInstance->Config->AdminEmail);
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_away.cpp b/src/cmd_away.cpp
index fa944932f..aecc711e4 100644
--- a/src/cmd_away.cpp
+++ b/src/cmd_away.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_away(Instance);
}
-void cmd_away::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_away::Handle (const char** parameters, int pcnt, userrec *user)
{
if ((pcnt) && (*parameters[0]))
{
@@ -40,4 +40,5 @@ void cmd_away::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("305 %s :You are no longer marked as being away",user->nick);
FOREACH_MOD(I_OnCancelAway,OnCancelAway(user));
}
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_commands.cpp b/src/cmd_commands.cpp
index 6ffd0c469..b6c0b1a24 100644
--- a/src/cmd_commands.cpp
+++ b/src/cmd_commands.cpp
@@ -25,11 +25,12 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_commands(Instance);
}
-void cmd_commands::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_commands::Handle (const char** parameters, int pcnt, userrec *user)
{
for (nspace::hash_map<std::string,command_t*>::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
{
user->WriteServ("902 %s :%s %s %d",user->nick,i->second->command.c_str(),i->second->source.c_str(),i->second->min_params);
}
user->WriteServ("903 %s :End of COMMANDS list",user->nick);
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_connect.cpp b/src/cmd_connect.cpp
index cf885c5bb..4c1d6d7a9 100644
--- a/src/cmd_connect.cpp
+++ b/src/cmd_connect.cpp
@@ -27,7 +27,8 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_connect(Instance);
}
-void cmd_connect::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_connect::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ( "NOTICE %s :You are a nub. Load a linking module.", user->nick);
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_die.cpp b/src/cmd_die.cpp
index fc2cc473e..06b8b79e8 100644
--- a/src/cmd_die.cpp
+++ b/src/cmd_die.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_die(Instance);
}
-void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
{
if (!strcmp(parameters[0],ServerInstance->Config->diepass))
{
@@ -53,5 +53,7 @@ void cmd_die::Handle (const char** parameters, int pcnt, userrec *user)
{
ServerInstance->Log(SPARSE, "Failed /DIE command from %s!%s@%s", user->nick, user->ident, user->host);
ServerInstance->WriteOpers("*** Failed DIE Command from %s!%s@%s.",user->nick,user->ident,user->host);
+ return CMD_FAILURE;
}
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_eline.cpp b/src/cmd_eline.cpp
index 971649989..3a11fe024 100644
--- a/src/cmd_eline.cpp
+++ b/src/cmd_eline.cpp
@@ -27,17 +27,17 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_eline(Instance);
}
-void cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
if (ServerInstance->HostMatchesEveryone(parameters[0],user))
- return;
+ return CMD_FAILURE;
if (!strchr(parameters[0],'@'))
{
user->WriteServ("NOTICE %s :*** E-Line must contain a username, e.g. *@%s",user->nick,parameters[0]);
- return;
+ return CMD_FAILURE;
}
ServerInstance->XLines->add_eline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]);
@@ -65,5 +65,5 @@ void cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
}
}
- // no need to apply the lines for an eline
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_gline.cpp b/src/cmd_gline.cpp
index 2d14fff22..85fe137b4 100644
--- a/src/cmd_gline.cpp
+++ b/src/cmd_gline.cpp
@@ -27,17 +27,17 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_gline(Instance);
}
-void cmd_gline::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_gline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
if (ServerInstance->HostMatchesEveryone(parameters[0],user))
- return;
+ return CMD_FAILURE;
if (!strchr(parameters[0],'@'))
{
user->WriteServ("NOTICE %s :*** G-Line must contain a username, e.g. *@%s",user->nick,parameters[0]);
- return;
+ return CMD_FAILURE;
}
ServerInstance->XLines->add_gline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]);
@@ -66,4 +66,7 @@ void cmd_gline::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("NOTICE %s :*** G-Line %s not found in list, try /stats g.",user->nick,parameters[0]);
}
}
+
+ return CMD_SUCCESS;
}
+
diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp
index ce6358fd0..b592b7869 100644
--- a/src/cmd_info.cpp
+++ b/src/cmd_info.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_info(Instance);
}
-void cmd_info::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_info::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ( "371 %s :. o O (The Inspire Internet Relay Chat Server) O o .", user->nick);
user->WriteServ( "371 %s : ", user->nick);
@@ -74,4 +74,5 @@ void cmd_info::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ( "371 %s :Best experienced with: An IRC client.", user->nick);
FOREACH_MOD(I_OnInfo,OnInfo(user));
user->WriteServ( "374 %s :End of /INFO list", user->nick);
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index 306823b8b..587dbc5f3 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_invite(Instance);
}
-void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
{
int MOD_RESULT = 0;
@@ -46,7 +46,7 @@ void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
- return;
+ return CMD_FAILURE;
}
if ((c->modes[CM_INVITEONLY]) && (IS_LOCAL(user)))
@@ -54,27 +54,27 @@ void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
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;
}
}
if (c->HasUser(u))
{
user->WriteServ("443 %s %s %s :Is already on channel %s",user->nick,u->nick,c->name,c->name);
- return;
+ return CMD_FAILURE;
}
if ((IS_LOCAL(user)) && (!c->HasUser(user)))
{
user->WriteServ("442 %s %s :You're not on that channel!",user->nick, c->name);
- return;
+ return CMD_FAILURE;
}
FOREACH_RESULT(I_OnUserPreInvite,OnUserPreInvite(user,u,c));
if (MOD_RESULT == 1)
{
- return;
+ return CMD_FAILURE;
}
irc::string xname(c->name);
@@ -94,4 +94,6 @@ void cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
}
user->WriteServ("347 %s :End of INVITE list",user->nick);
}
+ return CMD_SUCCESS;
}
+
diff --git a/src/cmd_ison.cpp b/src/cmd_ison.cpp
index bd5fdac9f..72f5ded7c 100644
--- a/src/cmd_ison.cpp
+++ b/src/cmd_ison.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_ison(Instance);
}
-void cmd_ison::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_ison::Handle (const char** parameters, int pcnt, userrec *user)
{
char retbuf[MAXBUF];
userrec *u;
@@ -43,5 +43,8 @@ void cmd_ison::Handle (const char** parameters, int pcnt, userrec *user)
}
}
- user->WriteServ( retbuf);
+ user->WriteServ(retbuf);
+
+ return CMD_SUCCESS;
}
+
diff --git a/src/cmd_join.cpp b/src/cmd_join.cpp
index ee2131482..89483e1b4 100644
--- a/src/cmd_join.cpp
+++ b/src/cmd_join.cpp
@@ -25,30 +25,31 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_join(Instance);
}
-void cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_join::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt > 1)
{
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0, 1))
- return;
+ return CMD_SUCCESS;
if (ServerInstance->IsChannel(parameters[0]))
{
chanrec::JoinUser(ServerInstance, user, parameters[0], false, parameters[1]);
- return;
+ return CMD_SUCCESS;
}
}
else
{
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
- return;
+ return CMD_SUCCESS;
if (ServerInstance->IsChannel(parameters[0]))
{
chanrec::JoinUser(ServerInstance, user, parameters[0], false);
- return;
+ return CMD_SUCCESS;
}
}
user->WriteServ("403 %s %s :Invalid channel name",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
diff --git a/src/cmd_kick.cpp b/src/cmd_kick.cpp
index fd098c468..b20266e29 100644
--- a/src/cmd_kick.cpp
+++ b/src/cmd_kick.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_kick(Instance);
}
-void cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
{
char reason[MAXKICK];
chanrec* c = ServerInstance->FindChan(parameters[0]);
@@ -34,13 +34,13 @@ void cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
if (!u || !c)
{
user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]);
- return;
+ return CMD_FAILURE;
}
if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->ULine(user->server)))
{
user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0]);
- return;
+ return CMD_FAILURE;
}
if (pcnt > 2)
@@ -55,4 +55,6 @@ void cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
if (!c->KickUser(user, u, reason))
/* Nobody left here, delete the chanrec */
delete c;
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp
index 91dbca8bd..6fe855a19 100644
--- a/src/cmd_kill.cpp
+++ b/src/cmd_kill.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_kill(Instance);
}
-void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
{
userrec *u = ServerInstance->FindNick(parameters[0]);
char killreason[MAXBUF];
@@ -42,7 +42,7 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
if (MOD_RESULT)
{
ServerInstance->Log(DEBUG, "A module prevented the kill with result %d", MOD_RESULT);
- return;
+ return CMD_FAILURE;
}
if (!IS_LOCAL(u))
@@ -81,6 +81,9 @@ void cmd_kill::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0]);
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_kline.cpp b/src/cmd_kline.cpp
index 105c8c3c2..a72ea085d 100644
--- a/src/cmd_kline.cpp
+++ b/src/cmd_kline.cpp
@@ -27,17 +27,17 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_kline(Instance);
}
-void cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
if (ServerInstance->HostMatchesEveryone(parameters[0],user))
- return;
+ return CMD_FAILURE;
if (!strchr(parameters[0],'@'))
{
user->WriteServ("NOTICE %s :*** K-Line must contain a username, e.g. *@%s",user->nick,parameters[0]);
- return;
+ return CMD_FAILURE;
}
ServerInstance->XLines->add_kline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]);
@@ -66,5 +66,7 @@ void cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("NOTICE %s :*** K-Line %s not found in list, try /stats k.",user->nick,parameters[0]);
}
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_links.cpp b/src/cmd_links.cpp
index 46c35ca53..edb27ea31 100644
--- a/src/cmd_links.cpp
+++ b/src/cmd_links.cpp
@@ -26,8 +26,9 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_links(Instance);
}
-void cmd_links::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_links::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("364 %s %s %s :0 %s",user->nick,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc);
user->WriteServ("365 %s * :End of /LINKS list.",user->nick);
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_list.cpp b/src/cmd_list.cpp
index f281ce195..a5f5ed75f 100644
--- a/src/cmd_list.cpp
+++ b/src/cmd_list.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_list(Instance);
}
-void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("321 %s Channel :Users Name",user->nick);
for (chan_hash::const_iterator i = ServerInstance->chanlist.begin(); i != ServerInstance->chanlist.end(); i++)
@@ -44,4 +44,6 @@ void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
}
}
user->WriteServ("323 %s :End of channel list.",user->nick);
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_loadmodule.cpp b/src/cmd_loadmodule.cpp
index 2f1dc75d3..5e0c7ab6f 100644
--- a/src/cmd_loadmodule.cpp
+++ b/src/cmd_loadmodule.cpp
@@ -25,15 +25,18 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_loadmodule(Instance);
}
-void cmd_loadmodule::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_loadmodule::Handle (const char** parameters, int pcnt, userrec *user)
{
if (ServerInstance->LoadModule(parameters[0]))
{
ServerInstance->WriteOpers("*** NEW MODULE: %s",parameters[0]);
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;
}
}
+
diff --git a/src/cmd_lusers.cpp b/src/cmd_lusers.cpp
index 23b8754e0..93b87a94d 100644
--- a/src/cmd_lusers.cpp
+++ b/src/cmd_lusers.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_lusers(Instance);
}
-void cmd_lusers::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_lusers::Handle (const char** parameters, int pcnt, userrec *user)
{
// this lusers command shows one server at all times because
// a protocol module must override it to show those stats.
@@ -38,5 +38,7 @@ void cmd_lusers::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("254 %s %d :channels formed",user->nick,ServerInstance->ChannelCount());
if (ServerInstance->LocalUserCount())
user->WriteServ("254 %s :I have %d clients and 0 servers",user->nick,ServerInstance->LocalUserCount());
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_map.cpp b/src/cmd_map.cpp
index 702038aa0..a44030eeb 100644
--- a/src/cmd_map.cpp
+++ b/src/cmd_map.cpp
@@ -25,11 +25,13 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_map(Instance);
}
-void cmd_map::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_map::Handle (const char** parameters, int pcnt, userrec *user)
{
// as with /LUSERS this does nothing without a linking
// module to override its behaviour and display something
// better.
user->WriteServ("006 %s :%s",user->nick,ServerInstance->Config->ServerName);
user->WriteServ("007 %s :End of /MAP",user->nick);
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_mode.cpp b/src/cmd_mode.cpp
index c1d128bf9..545a14f8d 100644
--- a/src/cmd_mode.cpp
+++ b/src/cmd_mode.cpp
@@ -23,13 +23,9 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_mode(Instance);
}
-void cmd_mode::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_mode::Handle (const char** parameters, int pcnt, userrec *user)
{
- if (!user)
- return;
-
ServerInstance->Modes->Process(parameters, pcnt, user, false);
-
- return;
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp
index e1a5b6d4b..fe6fa0258 100644
--- a/src/cmd_modules.cpp
+++ b/src/cmd_modules.cpp
@@ -43,7 +43,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_modules(Instance);
}
-void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
{
for (unsigned int i = 0; i < ServerInstance->Config->module_names.size(); i++)
{
@@ -108,4 +108,6 @@ void cmd_modules::Handle (const char** parameters, int pcnt, userrec *user)
}
}
user->WriteServ("901 %s :End of MODULES list",user->nick);
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_motd.cpp b/src/cmd_motd.cpp
index 04542db17..44c6fba9e 100644
--- a/src/cmd_motd.cpp
+++ b/src/cmd_motd.cpp
@@ -24,7 +24,8 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_motd(Instance);
}
-void cmd_motd::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_motd::Handle (const char** parameters, int pcnt, userrec *user)
{
user->ShowMOTD();
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_names.cpp b/src/cmd_names.cpp
index e419c4172..8302136eb 100644
--- a/src/cmd_names.cpp
+++ b/src/cmd_names.cpp
@@ -25,18 +25,18 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_names(Instance);
}
-void cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_names::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_SUCCESS;
}
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
- return;
+ return CMD_SUCCESS;
c = ServerInstance->FindChan(parameters[0]);
if (c)
@@ -44,7 +44,7 @@ void cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
if ((c->modes[CM_SECRET]) && (!c->HasUser(user)))
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, c->name);
- return;
+ return CMD_FAILURE;
}
c->UserList(user);
user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, c->name);
@@ -53,4 +53,6 @@ void cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp
index e6e2a98bc..10d95ed46 100644
--- a/src/cmd_nick.cpp
+++ b/src/cmd_nick.cpp
@@ -28,40 +28,25 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_nick(Instance);
}
-void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
{
char oldnick[NICKMAX];
- if (pcnt < 1)
- {
- ServerInstance->Log(DEBUG,"not enough params for handle_nick");
- return;
- }
- if (!parameters[0])
- {
- ServerInstance->Log(DEBUG,"invalid parameter passed to handle_nick");
- return;
- }
- if (!parameters[0][0])
+ if (!*parameters[0])
{
ServerInstance->Log(DEBUG,"zero length new nick passed to handle_nick");
- return;
+ return CMD_FAILURE;
}
- if (!user)
- {
- ServerInstance->Log(DEBUG,"invalid user passed to handle_nick");
- return;
- }
- if (!user->nick)
+ if (!*user->nick)
{
ServerInstance->Log(DEBUG,"invalid old nick passed to handle_nick");
- return;
+ return CMD_FAILURE;
}
if (irc::string(user->nick) == irc::string(parameters[0]))
{
/* If its exactly the same, even case, dont do anything. */
if (!strcmp(user->nick,parameters[0]))
- return;
+ return CMD_SUCCESS;
/* Its a change of case. People insisted that they should be
* able to do silly things like this even though the RFC says
* the nick AAA is the same as the nick aaa.
@@ -71,12 +56,12 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
if (MOD_RESULT)
- return;
+ return CMD_FAILURE;
if (user->registered == REG_ALL)
user->WriteCommon("NICK %s",parameters[0]);
strlcpy(user->nick, parameters[0], NICKMAX - 1);
FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
- return;
+ return CMD_SUCCESS;
}
else
{
@@ -89,18 +74,26 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
{
ServerInstance->WriteOpers("*** Q-Lined nickname %s from %s!%s@%s: %s",parameters[0],user->nick,user->ident,user->host,mq);
user->WriteServ("432 %s %s :Invalid nickname: %s",user->nick,parameters[0],mq);
- return;
+ return CMD_FAILURE;
}
- if ((ServerInstance->FindNick(parameters[0])) && (ServerInstance->FindNick(parameters[0]) != user))
+ if ((ServerInstance->FindNick(parameters[0])) && (ServerInstance->FindNick(parameters[0]) != user) && (ServerInstance->IsNick(parameters[0])))
{
- user->WriteServ("433 %s %s :Nickname is already in use.",user->nick,parameters[0]);
- return;
+ userrec* InUse = ServerInstance->FindNick(parameters[0]);
+ if (InUse->registered != REG_ALL)
+ {
+ userrec::QuitUser(ServerInstance, InUse, "Nickname overruled");
+ }
+ else
+ {
+ user->WriteServ("433 %s %s :Nickname is already in use.",user->nick,parameters[0]);
+ return CMD_FAILURE;
+ }
}
}
if ((!ServerInstance->IsNick(parameters[0])) && (IS_LOCAL(user)))
{
user->WriteServ("432 %s %s :Erroneous Nickname",user->nick,parameters[0]);
- return;
+ return CMD_FAILURE;
}
if (user->registered == REG_ALL)
@@ -109,7 +102,7 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
if (MOD_RESULT) {
// if a module returns true, the nick change is silently forbidden.
- return;
+ return CMD_FAILURE;
}
user->WriteCommon("NICK %s",parameters[0]);
@@ -121,8 +114,8 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
/* change the nick of the user in the users_hash */
user = user->UpdateNickHash(parameters[0]);
/* actually change the nick within the record */
- if (!user) return;
- if (!user->nick) return;
+ if (!user) return CMD_FAILURE;
+ if (!*user->nick) return CMD_FAILURE;
strlcpy(user->nick, parameters[0], NICKMAX - 1);
@@ -158,4 +151,8 @@ void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
{
FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
}
+
+ return CMD_SUCCESS;
+
}
+
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index 7cd53aa3d..d018e1eb2 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -27,7 +27,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_notice(Instance);
}
-void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
userrec *dest;
chanrec *chan;
@@ -35,14 +35,14 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
user->idle_lastmsg = ServerInstance->Time();
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
- return;
+ return CMD_SUCCESS;
if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->ULine(user->server))))
{
int MOD_RESULT = 0;
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,(void*)parameters[0],TYPE_SERVER,temp,0));
if (MOD_RESULT)
- return;
+ return CMD_FAILURE;
parameters[1] = (char*)temp.c_str();
// notice to server mask
const char* servermask = parameters[0] + 1;
@@ -51,7 +51,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
user->NoticeAll("%s",parameters[1]);
}
FOREACH_MOD(I_OnUserMessage,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0));
- return;
+ return CMD_SUCCESS;
}
char status = 0;
if ((*parameters[0] == '@') || (*parameters[0] == '%') || (*parameters[0] == '+'))
@@ -69,12 +69,12 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
{
user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
- return;
+ return CMD_FAILURE;
}
if ((chan->modes[CM_MODERATED]) && (chan->GetStatus(user) < STATUS_VOICE))
{
user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
- return;
+ return CMD_FAILURE;
}
}
@@ -83,14 +83,14 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,chan,TYPE_CHANNEL,temp,status));
if (MOD_RESULT) {
- return;
+ return CMD_FAILURE;
}
parameters[1] = (char*)temp.c_str();
if (temp == "")
{
user->WriteServ("412 %s No text to send", user->nick);
- return;
+ return CMD_FAILURE;
}
chan->WriteAllExceptSender(user, status, "NOTICE %s :%s", chan->name, parameters[1]);
@@ -101,8 +101,9 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
/* no such nick/channel */
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
- return;
+ return CMD_SUCCESS;
}
dest = ServerInstance->FindNick(parameters[0]);
@@ -113,7 +114,7 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,dest,TYPE_USER,temp,0));
if (MOD_RESULT) {
- return;
+ return CMD_FAILURE;
}
parameters[1] = (char*)temp.c_str();
@@ -129,5 +130,10 @@ void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
/* no such nick/channel */
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
+
}
+
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index 7db6627e9..f2fbabc18 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -42,7 +42,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_oper(Instance);
}
-void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
{
char LoginName[MAXBUF];
char Password[MAXBUF];
@@ -83,7 +83,7 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick);
ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type invalid for OperType '%s'",OperType);
ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host);
- return;
+ return CMD_FAILURE;
}
found = true;
fail2 = false;
@@ -109,14 +109,16 @@ void cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("491 %s :Invalid oper credentials",user->nick);
ServerInstance->SNO->WriteToSnoMask('o',"WARNING! Failed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host);
ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.",user->nick,user->ident,user->host);
+ return CMD_FAILURE;
}
else
{
user->WriteServ("491 %s :Your oper block does not have a valid opertype associated with it",user->nick);
ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper block mismatch for OperType %s",OperType);
ServerInstance->Log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host);
+ return CMD_FAILURE;
}
}
- return;
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_part.cpp b/src/cmd_part.cpp
index 9fd01d058..cb5dde28e 100644
--- a/src/cmd_part.cpp
+++ b/src/cmd_part.cpp
@@ -25,10 +25,10 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_part(Instance);
}
-void cmd_part::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_part::Handle (const char** parameters, int pcnt, userrec *user)
{
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
- return;
+ return CMD_SUCCESS;
chanrec* c = ServerInstance->FindChan(parameters[0]);
@@ -41,5 +41,8 @@ void cmd_part::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]);
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_pass.cpp b/src/cmd_pass.cpp
index e761f8d42..4e5e739c2 100644
--- a/src/cmd_pass.cpp
+++ b/src/cmd_pass.cpp
@@ -24,13 +24,13 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_pass(Instance);
}
-void cmd_pass::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_pass::Handle (const char** parameters, int pcnt, userrec *user)
{
// Check to make sure they havnt registered -- Fix by FCS
if (user->registered == REG_ALL)
{
user->WriteServ("462 %s :You may not reregister",user->nick);
- return;
+ return CMD_FAILURE;
}
ConnectClass a = user->GetClass();
strlcpy(user->password,parameters[0],63);
@@ -38,4 +38,6 @@ void cmd_pass::Handle (const char** parameters, int pcnt, userrec *user)
{
user->haspassed = true;
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_ping.cpp b/src/cmd_ping.cpp
index 9ecec693c..bf5824133 100644
--- a/src/cmd_ping.cpp
+++ b/src/cmd_ping.cpp
@@ -25,7 +25,8 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_ping(Instance);
}
-void cmd_ping::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_ping::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("PONG %s :%s",ServerInstance->Config->ServerName,parameters[0]);
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_pong.cpp b/src/cmd_pong.cpp
index 9a388c021..5e619b5b1 100644
--- a/src/cmd_pong.cpp
+++ b/src/cmd_pong.cpp
@@ -24,8 +24,9 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_pong(Instance);
}
-void cmd_pong::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_pong::Handle (const char** parameters, int pcnt, userrec *user)
{
// set the user as alive so they survive to next ping
user->lastping = 1;
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index e387b6ae3..0623fcd85 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -28,7 +28,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_privmsg(Instance);
}
-void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
{
userrec *dest;
chanrec *chan;
@@ -36,7 +36,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
user->idle_lastmsg = ServerInstance->Time();
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
- return;
+ return CMD_SUCCESS;
if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->ULine(user->server))))
{
@@ -44,7 +44,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,(void*)parameters[0],TYPE_SERVER,temp,0));
if (MOD_RESULT)
- return;
+ return CMD_FAILURE;
parameters[1] = (char*)temp.c_str();
// notice to server mask
const char* servermask = parameters[0] + 1;
@@ -53,7 +53,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
ServerInstance->ServerPrivmsgAll("%s",parameters[1]);
}
FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0));
- return;
+ return CMD_SUCCESS;
}
char status = 0;
if ((*parameters[0] == '@') || (*parameters[0] == '%') || (*parameters[0] == '+'))
@@ -71,12 +71,12 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
{
user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
- return;
+ return CMD_FAILURE;
}
if ((chan->modes[CM_MODERATED]) && (chan->GetStatus(user) < STATUS_VOICE))
{
user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
- return;
+ return CMD_FAILURE;
}
}
int MOD_RESULT = 0;
@@ -84,14 +84,14 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,chan,TYPE_CHANNEL,temp,status));
if (MOD_RESULT) {
- return;
+ return CMD_FAILURE;
}
parameters[1] = (char*)temp.c_str();
if (temp == "")
{
user->WriteServ("412 %s No text to send", user->nick);
- return;
+ return CMD_FAILURE;
}
chan->WriteAllExceptSender(user, status, "PRIVMSG %s :%s", chan->name, parameters[1]);
@@ -101,8 +101,9 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
{
/* no such nick/channel */
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
- return;
+ return CMD_SUCCESS;
}
dest = ServerInstance->FindNick(parameters[0]);
@@ -119,7 +120,7 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
std::string temp = parameters[1];
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,dest,TYPE_USER,temp,0));
if (MOD_RESULT) {
- return;
+ return CMD_FAILURE;
}
parameters[1] = (char*)temp.c_str();
@@ -135,5 +136,8 @@ void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
{
/* no such nick/channel */
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
+ return CMD_SUCCESS;
}
+
diff --git a/src/cmd_qline.cpp b/src/cmd_qline.cpp
index 68e315822..a76302421 100644
--- a/src/cmd_qline.cpp
+++ b/src/cmd_qline.cpp
@@ -27,12 +27,12 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_qline(Instance);
}
-void cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
if (ServerInstance->NickMatchesEveryone(parameters[0],user))
- return;
+ return CMD_FAILURE;
ServerInstance->XLines->add_qline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]);
FOREACH_MOD(I_OnAddQLine,OnAddQLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0]));
if (!ServerInstance->Duration(parameters[1]))
@@ -55,6 +55,10 @@ void cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0]);
+ return CMD_FAILURE;
}
}
+
+ return CMD_SUCCESS;
}
+
diff --git a/src/cmd_quit.cpp b/src/cmd_quit.cpp
index 102d9adc5..bf64aea3d 100644
--- a/src/cmd_quit.cpp
+++ b/src/cmd_quit.cpp
@@ -27,7 +27,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_quit(Instance);
}
-void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
{
user_hash::iterator iter = ServerInstance->clientlist.find(user->nick);
char reason[MAXBUF];
@@ -100,5 +100,7 @@ void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
user->PurgeEmptyChannels();
}
DELETE(user);
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_rehash.cpp b/src/cmd_rehash.cpp
index c4ee2f94f..f53f810a4 100644
--- a/src/cmd_rehash.cpp
+++ b/src/cmd_rehash.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_rehash(Instance);
}
-void cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(CONFIG_FILE));
std::string parameter = "";
@@ -40,4 +40,7 @@ void cmd_rehash::Handle (const char** parameters, int pcnt, userrec *user)
ServerInstance->Config->Read(false,user);
}
FOREACH_MOD(I_OnRehash,OnRehash(parameter));
+
+ return CMD_SUCCESS;
}
+
diff --git a/src/cmd_restart.cpp b/src/cmd_restart.cpp
index 18f8d2fc9..2ab046f7e 100644
--- a/src/cmd_restart.cpp
+++ b/src/cmd_restart.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_restart(Instance);
}
-void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
{
char *argv[32];
ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
@@ -62,5 +62,9 @@ void cmd_restart::Handle (const char** parameters, int pcnt, userrec *user)
else
{
ServerInstance->WriteOpers("*** Failed RESTART Command from %s!%s@%s.",user->nick,user->ident,user->host);
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
+
diff --git a/src/cmd_rules.cpp b/src/cmd_rules.cpp
index e08b7c775..9e42b8a66 100644
--- a/src/cmd_rules.cpp
+++ b/src/cmd_rules.cpp
@@ -24,7 +24,8 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_rules(Instance);
}
-void cmd_rules::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_rules::Handle (const char** parameters, int pcnt, userrec *user)
{
user->ShowRULES();
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_server.cpp b/src/cmd_server.cpp
index b1f9a89d8..8ec65f681 100644
--- a/src/cmd_server.cpp
+++ b/src/cmd_server.cpp
@@ -25,8 +25,9 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_server(Instance);
}
-void cmd_server::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_server::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("666 %s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick);
ServerInstance->WriteOpers("*** WARNING: %s attempted to issue a SERVER command and is registered as a user!",user->nick);
+ return CMD_FAILURE;
}
diff --git a/src/cmd_squit.cpp b/src/cmd_squit.cpp
index facfcf694..fa3aadc78 100644
--- a/src/cmd_squit.cpp
+++ b/src/cmd_squit.cpp
@@ -27,7 +27,8 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_squit(Instance);
}
-void cmd_squit::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_squit::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ( "NOTICE %s :You are a nub. Load a linking module.", user->nick);
+ return CMD_FAILURE;
}
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp
index 44755451d..0e2935e5d 100644
--- a/src/cmd_stats.cpp
+++ b/src/cmd_stats.cpp
@@ -29,12 +29,14 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_stats(Instance);
}
-void cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
{
string_list values;
DoStats(this->ServerInstance, *parameters[0], user, values);
for (size_t i = 0; i < values.size(); i++)
user->Write(":%s", values[i].c_str());
+
+ return CMD_SUCCESS;
}
void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_list &results)
diff --git a/src/cmd_summon.cpp b/src/cmd_summon.cpp
index 968d62767..f8e493fc0 100644
--- a/src/cmd_summon.cpp
+++ b/src/cmd_summon.cpp
@@ -24,7 +24,8 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_summon(Instance);
}
-void cmd_summon::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_summon::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("445 %s :SUMMON has been disabled (depreciated command)",user->nick);
+ return CMD_FAILURE;
}
diff --git a/src/cmd_time.cpp b/src/cmd_time.cpp
index 04005a9a7..c034d4715 100644
--- a/src/cmd_time.cpp
+++ b/src/cmd_time.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_time(Instance);
}
-void cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
{
struct tm* timeinfo;
time_t local = ServerInstance->Time();
@@ -37,5 +37,6 @@ void cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
tms[24] = 0;
user->WriteServ("391 %s %s :%s",user->nick,ServerInstance->Config->ServerName,tms);
-
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp
index b97821434..6d2f6cf9e 100644
--- a/src/cmd_topic.cpp
+++ b/src/cmd_topic.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_topic(Instance);
}
-void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
{
chanrec* Ptr;
@@ -38,7 +38,7 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
if ((Ptr->modes[CM_SECRET]) && (!Ptr->HasUser(user)))
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, Ptr->name);
- return;
+ return CMD_FAILURE;
}
if (Ptr->topicset)
{
@@ -53,8 +53,9 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
- return;
+ return CMD_SUCCESS;
}
else if (pcnt>1)
{
@@ -66,12 +67,12 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
if (!Ptr->HasUser(user))
{
user->WriteServ("442 %s %s :You're not on that channel!",user->nick, Ptr->name);
- return;
+ return CMD_FAILURE;
}
if ((Ptr->modes[CM_TOPICLOCK]) && (Ptr->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, Ptr->name);
- return;
+ return CMD_FAILURE;
}
}
char topic[MAXTOPIC];
@@ -82,7 +83,7 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic));
if (MOD_RESULT)
- return;
+ return CMD_FAILURE;
}
strlcpy(Ptr->topic,topic,MAXTOPIC-1);
@@ -97,7 +98,9 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
}
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp
index 7332f4631..31dc27a28 100644
--- a/src/cmd_trace.cpp
+++ b/src/cmd_trace.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_trace(Instance);
}
-void cmd_trace::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_trace::Handle (const char** parameters, int pcnt, userrec *user)
{
for (user_hash::iterator i = ServerInstance->clientlist.begin(); i != ServerInstance->clientlist.end(); i++)
{
@@ -48,4 +48,5 @@ void cmd_trace::Handle (const char** parameters, int pcnt, userrec *user)
}
}
}
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_unloadmodule.cpp b/src/cmd_unloadmodule.cpp
index 1bb99014b..ba8e1f99d 100644
--- a/src/cmd_unloadmodule.cpp
+++ b/src/cmd_unloadmodule.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_unloadmodule(Instance);
}
-void cmd_unloadmodule::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_unloadmodule::Handle (const char** parameters, int pcnt, userrec *user)
{
if (ServerInstance->UnloadModule(parameters[0]))
{
@@ -35,5 +35,8 @@ void cmd_unloadmodule::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp
index 13e42f043..f7a22eb01 100644
--- a/src/cmd_user.cpp
+++ b/src/cmd_user.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_user(Instance);
}
-void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
{
if (user->registered < REG_NICKUSER)
{
@@ -33,6 +33,7 @@ void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
// This kinda Sucks, According to the RFC thou, its either this,
// or "You have already registered" :p -- Craig
user->WriteServ("461 %s USER :Not enough parameters",user->nick);
+ return CMD_FAILURE;
}
else {
/* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */
@@ -48,13 +49,14 @@ void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ("462 %s :You may not reregister",user->nick);
- return;
+ return CMD_FAILURE;
}
/* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */
if (user->registered == REG_NICKUSER)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
- //ConnectUser(user,NULL);
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp
index c124b24d3..52c0f0612 100644
--- a/src/cmd_userhost.cpp
+++ b/src/cmd_userhost.cpp
@@ -25,7 +25,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_userhost(Instance);
}
-void cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user)
{
char Return[MAXBUF],junk[MAXBUF];
snprintf(Return,MAXBUF,"302 %s :",user->nick);
@@ -50,4 +50,6 @@ void cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user)
}
}
user->WriteServ(Return);
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_users.cpp b/src/cmd_users.cpp
index 43f5c2105..d9e3a72cf 100644
--- a/src/cmd_users.cpp
+++ b/src/cmd_users.cpp
@@ -24,7 +24,8 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_users(Instance);
}
-void cmd_users::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_users::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("445 %s :USERS has been disabled (depreciated command)",user->nick);
+ return CMD_FAILURE;
}
diff --git a/src/cmd_version.cpp b/src/cmd_version.cpp
index 5e1db8c2e..311659e59 100644
--- a/src/cmd_version.cpp
+++ b/src/cmd_version.cpp
@@ -26,7 +26,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_version(Instance);
}
-void cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
{
std::stringstream out(ServerInstance->Config->data005);
std::string token = "";
@@ -48,4 +48,6 @@ void cmd_version::Handle (const char** parameters, int pcnt, userrec *user)
token_counter = 0;
}
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_wallops.cpp b/src/cmd_wallops.cpp
index 93256ec64..ae2ee6d9d 100644
--- a/src/cmd_wallops.cpp
+++ b/src/cmd_wallops.cpp
@@ -25,8 +25,9 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_wallops(Instance);
}
-void cmd_wallops::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_wallops::Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteWallOps(std::string(parameters[0]));
FOREACH_MOD(I_OnWallops,OnWallops(user,parameters[0]));
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp
index e48e013ec..0add5a09f 100644
--- a/src/cmd_who.cpp
+++ b/src/cmd_who.cpp
@@ -61,7 +61,7 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_who(Instance);
}
-void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
{
/*
* XXX - RFC says:
@@ -235,10 +235,12 @@ void cmd_who::Handle (const char** parameters, int pcnt, userrec *user)
for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
user->WriteServ(*n);
user->WriteServ("315 %s %s :End of /WHO list.",user->nick, *parameters[0] ? parameters[0] : "*");
+ return CMD_SUCCESS;
}
else
{
/* BZZT! Too many results. */
user->WriteServ("315 %s %s :Too many results",user->nick, parameters[0]);
+ return CMD_FAILURE;
}
}
diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp
index a9577f168..d48d1a10c 100644
--- a/src/cmd_whois.cpp
+++ b/src/cmd_whois.cpp
@@ -98,11 +98,11 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_whois(Instance);
}
-void cmd_whois::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_whois::Handle (const char** parameters, int pcnt, userrec *user)
{
userrec *dest;
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
- return;
+ return CMD_SUCCESS;
dest = ServerInstance->FindNick(parameters[0]);
if (dest)
@@ -114,6 +114,9 @@ void cmd_whois::Handle (const char** parameters, int pcnt, userrec *user)
/* no such nick/channel */
user->WriteServ("401 %s %s :No such nick/channel",user->nick, *parameters[0] ? parameters[0] : "*");
user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, *parameters[0] ? parameters[0] : "*");
+ return CMD_FAILURE;
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index 4f0cfdc21..fe3171fc5 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -25,13 +25,14 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_whowas(Instance);
}
-void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
+CmdResult cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
{
irc::whowas::whowas_users::iterator i = ServerInstance->whowas.find(parameters[0]);
if (i == ServerInstance->whowas.end())
{
user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]);
+ return CMD_FAILURE;
}
else
{
@@ -65,8 +66,11 @@ void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
else
{
user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]);
+ return CMD_FAILURE;
}
}
user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]);
+
+ return CMD_SUCCESS;
}
diff --git a/src/cmd_zline.cpp b/src/cmd_zline.cpp
index 183fec5d5..9b24489b8 100644
--- a/src/cmd_zline.cpp
+++ b/src/cmd_zline.cpp
@@ -28,17 +28,19 @@ extern "C" command_t* init_command(InspIRCd* Instance)
return new cmd_zline(Instance);
}
-void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
{
if (pcnt >= 3)
{
if (strchr(parameters[0],'@'))
{
user->WriteServ("NOTICE %s :*** You cannot include a username in a zline, a zline must ban only an IP mask",user->nick);
- return;
+ return CMD_FAILURE;
}
+
if (ServerInstance->IPMatchesEveryone(parameters[0],user))
- return;
+ return CMD_FAILURE;
+
ServerInstance->XLines->add_zline(ServerInstance->Duration(parameters[1]),user->nick,parameters[2],parameters[0]);
FOREACH_MOD(I_OnAddZLine,OnAddZLine(ServerInstance->Duration(parameters[1]), user, parameters[2], parameters[0]));
if (!ServerInstance->Duration(parameters[1]))
@@ -61,6 +63,9 @@ void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
else
{
user->WriteServ("NOTICE %s :*** Z-Line %s not found in list, try /stats Z.",user->nick,parameters[0]);
+ return CMD_FAILURE;
}
}
+
+ return CMD_SUCCESS;
}
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 369aac19f..b9113dfc5 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -594,7 +594,7 @@ class cmd_rconnect : public command_t
syntax = "<remote-server-mask> <servermask>";
}
- void Handle (const char** parameters, int pcnt, userrec *user)
+ CmdResult Handle (const char** parameters, int pcnt, userrec *user)
{
user->WriteServ("NOTICE %s :*** RCONNECT: Sending remote connect to \002%s\002 to connect server \002%s\002.",user->nick,parameters[0],parameters[1]);
/* Is this aimed at our server? */
@@ -605,7 +605,11 @@ class cmd_rconnect : public command_t
const char* para[1];
para[0] = parameters[1];
Creator->OnPreCommand("CONNECT", para, 1, user, true);
+
+ return CMD_SUCCESS;
}
+
+ return CMD_FAILURE;
}
};