summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-20 19:07:07 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-20 19:07:07 +0000
commitdd36852a52e8541306b76c5b88bce8ab9b36654c (patch)
tree045b4eb051d43ca64f395b15f7b190f2159d51f0 /src/commands
parent5509c602cb8783ceadf8028ff80c5dbeb4818704 (diff)
Wheee, mass commit! this adds const stafety, throwing a compile error if anyone does: "parameters[n] = blahvar;" in a command handler etc. where they REALLY SHOULD NOT fuck with the value and should
copy the pointer. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8971 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/cmd_admin.cpp2
-rw-r--r--src/commands/cmd_away.cpp2
-rw-r--r--src/commands/cmd_clearcache.cpp2
-rw-r--r--src/commands/cmd_commands.cpp2
-rw-r--r--src/commands/cmd_connect.cpp2
-rw-r--r--src/commands/cmd_die.cpp2
-rw-r--r--src/commands/cmd_eline.cpp2
-rw-r--r--src/commands/cmd_gline.cpp2
-rw-r--r--src/commands/cmd_info.cpp2
-rw-r--r--src/commands/cmd_invite.cpp2
-rw-r--r--src/commands/cmd_ison.cpp2
-rw-r--r--src/commands/cmd_join.cpp2
-rw-r--r--src/commands/cmd_kick.cpp2
-rw-r--r--src/commands/cmd_kill.cpp2
-rw-r--r--src/commands/cmd_kline.cpp2
-rw-r--r--src/commands/cmd_links.cpp2
-rw-r--r--src/commands/cmd_list.cpp2
-rw-r--r--src/commands/cmd_loadmodule.cpp2
-rw-r--r--src/commands/cmd_lusers.cpp2
-rw-r--r--src/commands/cmd_map.cpp2
-rw-r--r--src/commands/cmd_mode.cpp2
-rw-r--r--src/commands/cmd_modules.cpp2
-rw-r--r--src/commands/cmd_motd.cpp2
-rw-r--r--src/commands/cmd_names.cpp2
-rw-r--r--src/commands/cmd_nick.cpp2
-rw-r--r--src/commands/cmd_notice.cpp45
-rw-r--r--src/commands/cmd_oper.cpp2
-rw-r--r--src/commands/cmd_part.cpp2
-rw-r--r--src/commands/cmd_pass.cpp2
-rw-r--r--src/commands/cmd_ping.cpp2
-rw-r--r--src/commands/cmd_pong.cpp2
-rw-r--r--src/commands/cmd_privmsg.cpp44
-rw-r--r--src/commands/cmd_qline.cpp2
-rw-r--r--src/commands/cmd_quit.cpp2
-rw-r--r--src/commands/cmd_rehash.cpp2
-rw-r--r--src/commands/cmd_reloadmodule.cpp2
-rw-r--r--src/commands/cmd_restart.cpp2
-rw-r--r--src/commands/cmd_rules.cpp2
-rw-r--r--src/commands/cmd_server.cpp2
-rw-r--r--src/commands/cmd_squit.cpp2
-rw-r--r--src/commands/cmd_stats.cpp2
-rw-r--r--src/commands/cmd_time.cpp2
-rw-r--r--src/commands/cmd_topic.cpp2
-rw-r--r--src/commands/cmd_trace.cpp2
-rw-r--r--src/commands/cmd_unloadmodule.cpp2
-rw-r--r--src/commands/cmd_user.cpp2
-rw-r--r--src/commands/cmd_userhost.cpp2
-rw-r--r--src/commands/cmd_version.cpp2
-rw-r--r--src/commands/cmd_wallops.cpp2
-rw-r--r--src/commands/cmd_who.cpp2
-rw-r--r--src/commands/cmd_whois.cpp2
-rw-r--r--src/commands/cmd_whowas.cpp2
-rw-r--r--src/commands/cmd_zline.cpp2
53 files changed, 96 insertions, 95 deletions
diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp
index 9957c97d2..8f5dfd3f8 100644
--- a/src/commands/cmd_admin.cpp
+++ b/src/commands/cmd_admin.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /ADMIN
*/
-CmdResult CommandAdmin::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandAdmin::Handle (const char* const* parameters, int pcnt, User *user)
{
user->WriteServ("256 %s :Administrative info for %s",user->nick,ServerInstance->Config->ServerName);
if (*ServerInstance->Config->AdminName)
diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp
index dd708edfc..ffddbba44 100644
--- a/src/commands/cmd_away.cpp
+++ b/src/commands/cmd_away.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /AWAY
*/
-CmdResult CommandAway::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandAway::Handle (const char* const* parameters, int pcnt, User *user)
{
if ((pcnt) && (*parameters[0]))
{
diff --git a/src/commands/cmd_clearcache.cpp b/src/commands/cmd_clearcache.cpp
index 250e4b825..c7354df07 100644
--- a/src/commands/cmd_clearcache.cpp
+++ b/src/commands/cmd_clearcache.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /CLEARCACHE
*/
-CmdResult CommandClearcache::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandClearcache::Handle (const char* const* parameters, int pcnt, User *user)
{
int n = ServerInstance->Res->ClearCache();
user->WriteServ("NOTICE %s :*** Cleared DNS cache of %d items.", user->nick, n);
diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp
index 7fe1a9ffa..e559a9e2f 100644
--- a/src/commands/cmd_commands.cpp
+++ b/src/commands/cmd_commands.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandCommands(Instance);
}
-CmdResult CommandCommands::Handle (const char**, int, User *user)
+CmdResult CommandCommands::Handle (const char* const*, int, User *user)
{
for (Commandable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++)
{
diff --git a/src/commands/cmd_connect.cpp b/src/commands/cmd_connect.cpp
index 7eb909c10..04aada207 100644
--- a/src/commands/cmd_connect.cpp
+++ b/src/commands/cmd_connect.cpp
@@ -25,7 +25,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /CONNECT
*/
-CmdResult CommandConnect::Handle (const char**, int, User *user)
+CmdResult CommandConnect::Handle (const char* const*, int, User *user)
{
user->WriteServ( "NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick);
return CMD_SUCCESS;
diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp
index 0afb6f248..960cefe63 100644
--- a/src/commands/cmd_die.cpp
+++ b/src/commands/cmd_die.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /DIE
*/
-CmdResult CommandDie::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandDie::Handle (const char* const* parameters, int pcnt, User *user)
{
if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0], ServerInstance->Config->powerhash))
{
diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp
index 5893fd9b7..fa9ddd708 100644
--- a/src/commands/cmd_eline.cpp
+++ b/src/commands/cmd_eline.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /ELINE
*/
-CmdResult CommandEline::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandEline::Handle (const char* const* parameters, int pcnt, User *user)
{
std::string target = parameters[0];
diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp
index 0061bfe00..a6bec9c0e 100644
--- a/src/commands/cmd_gline.cpp
+++ b/src/commands/cmd_gline.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /GLINE
*/
-CmdResult CommandGline::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandGline::Handle (const char* const* parameters, int pcnt, User *user)
{
std::string target = parameters[0];
diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp
index 65a9713f7..64d438b83 100644
--- a/src/commands/cmd_info.cpp
+++ b/src/commands/cmd_info.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /INFO
*/
-CmdResult CommandInfo::Handle (const char**, int, User *user)
+CmdResult CommandInfo::Handle (const char* const*, int, User *user)
{
user->WriteServ( "371 %s : -/\\- \2InspIRCd\2 -\\/-", user->nick);
user->WriteServ( "371 %s : November 2002 - Present", user->nick);
diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp
index 42905d9bf..49296ca42 100644
--- a/src/commands/cmd_invite.cpp
+++ b/src/commands/cmd_invite.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /INVITE
*/
-CmdResult CommandInvite::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandInvite::Handle (const char* const* parameters, int pcnt, User *user)
{
int MOD_RESULT = 0;
diff --git a/src/commands/cmd_ison.cpp b/src/commands/cmd_ison.cpp
index b0e77129e..ba119e251 100644
--- a/src/commands/cmd_ison.cpp
+++ b/src/commands/cmd_ison.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /ISON
*/
-CmdResult CommandIson::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandIson::Handle (const char* const* parameters, int pcnt, User *user)
{
std::map<User*,User*> ison_already;
User *u;
diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp
index 1c640b326..513901e47 100644
--- a/src/commands/cmd_join.cpp
+++ b/src/commands/cmd_join.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /JOIN
*/
-CmdResult CommandJoin::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandJoin::Handle (const char* const* parameters, int pcnt, User *user)
{
if (pcnt > 1)
{
diff --git a/src/commands/cmd_kick.cpp b/src/commands/cmd_kick.cpp
index 0a6e34cb2..329a37bcf 100644
--- a/src/commands/cmd_kick.cpp
+++ b/src/commands/cmd_kick.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /KICK
*/
-CmdResult CommandKick::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandKick::Handle (const char* const* parameters, int pcnt, User *user)
{
char reason[MAXKICK];
Channel* c = ServerInstance->FindChan(parameters[0]);
diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp
index 6a1e64d7f..c92b8a6b0 100644
--- a/src/commands/cmd_kill.cpp
+++ b/src/commands/cmd_kill.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /KILL
*/
-CmdResult CommandKill::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *user)
{
/* Allow comma seperated lists of users for /KILL (thanks w00t) */
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp
index d96873dc1..b4464a6d3 100644
--- a/src/commands/cmd_kline.cpp
+++ b/src/commands/cmd_kline.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /KLINE
*/
-CmdResult CommandKline::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandKline::Handle (const char* const* parameters, int pcnt, User *user)
{
std::string target = parameters[0];
diff --git a/src/commands/cmd_links.cpp b/src/commands/cmd_links.cpp
index 663e40881..973e5f0a6 100644
--- a/src/commands/cmd_links.cpp
+++ b/src/commands/cmd_links.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /LINKS
*/
-CmdResult CommandLinks::Handle (const char**, int, User *user)
+CmdResult CommandLinks::Handle (const char* const*, int, User *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);
diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp
index 970e26117..2ead367a4 100644
--- a/src/commands/cmd_list.cpp
+++ b/src/commands/cmd_list.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandList(Instance);
}
-CmdResult CommandList::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *user)
{
int minusers = 0, maxusers = 0;
diff --git a/src/commands/cmd_loadmodule.cpp b/src/commands/cmd_loadmodule.cpp
index 15678e5fc..043bae14e 100644
--- a/src/commands/cmd_loadmodule.cpp
+++ b/src/commands/cmd_loadmodule.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /LOADMODULE
*/
-CmdResult CommandLoadmodule::Handle (const char** parameters, int, User *user)
+CmdResult CommandLoadmodule::Handle (const char* const* parameters, int, User *user)
{
if (ServerInstance->Modules->Load(parameters[0]))
{
diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp
index 317229ceb..401b41b2e 100644
--- a/src/commands/cmd_lusers.cpp
+++ b/src/commands/cmd_lusers.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /LUSERS
*/
-CmdResult CommandLusers::Handle (const char**, int, User *user)
+CmdResult CommandLusers::Handle (const char* const*, int, User *user)
{
// this lusers command shows one server at all times because
// a protocol module must override it to show those stats.
diff --git a/src/commands/cmd_map.cpp b/src/commands/cmd_map.cpp
index ce132494e..2ace70725 100644
--- a/src/commands/cmd_map.cpp
+++ b/src/commands/cmd_map.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /MAP
*/
-CmdResult CommandMap::Handle (const char**, int, User *user)
+CmdResult CommandMap::Handle (const char* const*, int, User *user)
{
// as with /LUSERS this does nothing without a linking
// module to override its behaviour and display something
diff --git a/src/commands/cmd_mode.cpp b/src/commands/cmd_mode.cpp
index dafb493cb..25fec59b9 100644
--- a/src/commands/cmd_mode.cpp
+++ b/src/commands/cmd_mode.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /MODE
*/
-CmdResult CommandMode::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandMode::Handle (const char* const* parameters, int pcnt, User *user)
{
ServerInstance->Modes->Process(parameters, pcnt, user, false);
return CMD_SUCCESS;
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 7649dbc91..482eb82e4 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -38,7 +38,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /MODULES
*/
-CmdResult CommandModules::Handle (const char**, int, User *user)
+CmdResult CommandModules::Handle (const char* const*, int, User *user)
{
std::vector<std::string> module_names = ServerInstance->Modules->GetAllModuleNames(0);
diff --git a/src/commands/cmd_motd.cpp b/src/commands/cmd_motd.cpp
index 6875ca0ed..b6584303d 100644
--- a/src/commands/cmd_motd.cpp
+++ b/src/commands/cmd_motd.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /MOTD
*/
-CmdResult CommandMotd::Handle (const char**, int, User *user)
+CmdResult CommandMotd::Handle (const char* const*, int, User *user)
{
user->ShowMOTD();
return CMD_SUCCESS;
diff --git a/src/commands/cmd_names.cpp b/src/commands/cmd_names.cpp
index bfde4e40a..1c5327327 100644
--- a/src/commands/cmd_names.cpp
+++ b/src/commands/cmd_names.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /NAMES
*/
-CmdResult CommandNames::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandNames::Handle (const char* const* parameters, int pcnt, User *user)
{
Channel* c;
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp
index 5a7ed846a..2caa9b25a 100644
--- a/src/commands/cmd_nick.cpp
+++ b/src/commands/cmd_nick.cpp
@@ -25,7 +25,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
* for the client introduction code in here, youre in the wrong place.
* You need to look in the spanningtree module for this!
*/
-CmdResult CommandNick::Handle (const char** parameters, int, User *user)
+CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
{
char oldnick[NICKMAX];
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index 9a5248c0f..5822551da 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -20,7 +20,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandNotice(Instance);
}
-CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *user)
{
User *dest;
Channel *chan;
@@ -38,26 +38,27 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,(void*)parameters[0],TYPE_SERVER,temp,0,exempt_list));
if (MOD_RESULT)
return CMD_FAILURE;
- parameters[1] = temp.c_str();
- // notice to server mask
+ const char* text = temp.c_str();
const char* servermask = parameters[0] + 1;
- FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,exempt_list));
+
+ FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,text,0,exempt_list));
if (match(ServerInstance->Config->ServerName,servermask))
{
- user->SendAll("NOTICE", "%s", parameters[1]);
+ user->SendAll("NOTICE", "%s", text);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,exempt_list));
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,text,0,exempt_list));
return CMD_SUCCESS;
}
char status = 0;
- if ((*parameters[0] == '@') || (*parameters[0] == '%') || (*parameters[0] == '+'))
+ const char* target = parameters[0];
+ if ((*target == '@') || (*target == '%') || (*target == '+'))
{
- status = *parameters[0];
- parameters[0]++;
+ status = *target;
+ target++;
}
- if (*parameters[0] == '#')
+ if (*target == '#')
{
- chan = ServerInstance->FindChan(parameters[0]);
+ chan = ServerInstance->FindChan(target);
exempt_list[user] = user->nick;
@@ -83,7 +84,7 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
if (MOD_RESULT) {
return CMD_FAILURE;
}
- parameters[1] = temp.c_str();
+ const char* text = temp.c_str();
if (temp.empty())
{
@@ -91,30 +92,30 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
return CMD_FAILURE;
}
- FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,parameters[1],status,exempt_list));
+ FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,text,status,exempt_list));
if (status)
{
if (ServerInstance->Config->UndernetMsgPrefix)
{
- chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%c %s", status, chan->name, status, parameters[1]);
+ chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%c %s", status, chan->name, status, text);
}
else
{
- chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%s", status, chan->name, parameters[1]);
+ chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %c%s :%s", status, chan->name, text);
}
}
else
{
- chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %s :%s", chan->name, parameters[1]);
+ chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %s :%s", chan->name, text);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,parameters[1],status,exempt_list));
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,text,status,exempt_list));
}
else
{
/* no such nick/channel */
- user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, target);
return CMD_FAILURE;
}
return CMD_SUCCESS;
@@ -158,17 +159,17 @@ CmdResult CommandNotice::Handle (const char** parameters, int pcnt, User *user)
if (MOD_RESULT) {
return CMD_FAILURE;
}
- parameters[1] = (char*)temp.c_str();
+ const char* text = temp.c_str();
- FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,parameters[1],0,exempt_list));
+ FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,text,0,exempt_list));
if (IS_LOCAL(dest))
{
// direct write, same server
- user->WriteTo(dest, "NOTICE %s :%s", dest->nick, parameters[1]);
+ user->WriteTo(dest, "NOTICE %s :%s", dest->nick, text);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,dest,TYPE_USER,parameters[1],0,exempt_list));
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,dest,TYPE_USER,text,0,exempt_list));
}
else
{
diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp
index 4d4c54932..608d04ba6 100644
--- a/src/commands/cmd_oper.cpp
+++ b/src/commands/cmd_oper.cpp
@@ -35,7 +35,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandOper(Instance);
}
-CmdResult CommandOper::Handle (const char** parameters, int, User *user)
+CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
{
char LoginName[MAXBUF];
char Password[MAXBUF];
diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp
index 5137a32ca..002ae722b 100644
--- a/src/commands/cmd_part.cpp
+++ b/src/commands/cmd_part.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandPart(Instance);
}
-CmdResult CommandPart::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *user)
{
std::string reason;
diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp
index 94a7c6e87..fc09d2a41 100644
--- a/src/commands/cmd_pass.cpp
+++ b/src/commands/cmd_pass.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandPass(Instance);
}
-CmdResult CommandPass::Handle (const char** parameters, int, User *user)
+CmdResult CommandPass::Handle (const char* const* parameters, int, User *user)
{
// Check to make sure they havnt registered -- Fix by FCS
if (user->registered == REG_ALL)
diff --git a/src/commands/cmd_ping.cpp b/src/commands/cmd_ping.cpp
index e989f057a..3aeafe15e 100644
--- a/src/commands/cmd_ping.cpp
+++ b/src/commands/cmd_ping.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandPing(Instance);
}
-CmdResult CommandPing::Handle (const char** parameters, int, User *user)
+CmdResult CommandPing::Handle (const char* const* parameters, int, User *user)
{
user->WriteServ("PONG %s :%s",ServerInstance->Config->ServerName,parameters[0]);
return CMD_SUCCESS;
diff --git a/src/commands/cmd_pong.cpp b/src/commands/cmd_pong.cpp
index 05ee55378..51c951eba 100644
--- a/src/commands/cmd_pong.cpp
+++ b/src/commands/cmd_pong.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandPong(Instance);
}
-CmdResult CommandPong::Handle (const char**, int, User *user)
+CmdResult CommandPong::Handle (const char* const*, int, User *user)
{
// set the user as alive so they survive to next ping
user->lastping = 1;
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index f02700659..e78e2208a 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -20,7 +20,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandPrivmsg(Instance);
}
-CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User *user)
{
User *dest;
Channel *chan;
@@ -38,26 +38,26 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,(void*)parameters[0],TYPE_SERVER,temp,0,except_list));
if (MOD_RESULT)
return CMD_FAILURE;
- parameters[1] = temp.c_str();
- // notice to server mask
+ const char* text = temp.c_str();
const char* servermask = parameters[0] + 1;
- FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,except_list));
+ FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,text,0,except_list));
if (match(ServerInstance->Config->ServerName,servermask))
{
- user->SendAll("PRIVMSG", "%s", parameters[1]);
+ user->SendAll("PRIVMSG", "%s", text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,except_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,text,0,except_list));
return CMD_SUCCESS;
}
char status = 0;
- if ((*parameters[0] == '@') || (*parameters[0] == '%') || (*parameters[0] == '+'))
+ const char* target = parameters[0];
+ if ((*target == '@') || (*target == '%') || (*target == '+'))
{
- status = *parameters[0];
- parameters[0]++;
+ status = *target;
+ target++;
}
- if (parameters[0][0] == '#')
+ if (*target == '#')
{
- chan = ServerInstance->FindChan(parameters[0]);
+ chan = ServerInstance->FindChan(target);
except_list[user] = user->nick;
@@ -83,7 +83,7 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
if (MOD_RESULT) {
return CMD_FAILURE;
}
- parameters[1] = temp.c_str();
+ const char* text = temp.c_str();
/* Check again, a module may have zapped the input string */
if (temp.empty())
@@ -92,30 +92,30 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
return CMD_FAILURE;
}
- FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,parameters[1],status,except_list));
+ FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,text,status,except_list));
if (status)
{
if (ServerInstance->Config->UndernetMsgPrefix)
{
- chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%c %s", status, chan->name, status, parameters[1]);
+ chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%c %s", status, chan->name, status, text);
}
else
{
- chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%s", status, chan->name, parameters[1]);
+ chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %c%s :%s", status, chan->name, text);
}
}
else
{
- chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name, parameters[1]);
+ chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name, text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,parameters[1],status,except_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,text,status,except_list));
}
else
{
/* no such nick/channel */
- user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteServ("401 %s %s :No such nick/channel",user->nick, target);
return CMD_FAILURE;
}
return CMD_SUCCESS;
@@ -166,17 +166,17 @@ CmdResult CommandPrivmsg::Handle (const char** parameters, int pcnt, User *user)
if (MOD_RESULT) {
return CMD_FAILURE;
}
- parameters[1] = (char*)temp.c_str();
+ const char* text = temp.c_str();
- FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,parameters[1],0,except_list));
+ FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,text,0,except_list));
if (IS_LOCAL(dest))
{
// direct write, same server
- user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick, parameters[1]);
+ user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick, text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,parameters[1],0,except_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,text,0,except_list));
}
else
{
diff --git a/src/commands/cmd_qline.cpp b/src/commands/cmd_qline.cpp
index 2c3647d9f..97d26ba9f 100644
--- a/src/commands/cmd_qline.cpp
+++ b/src/commands/cmd_qline.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandQline(Instance);
}
-CmdResult CommandQline::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandQline::Handle (const char* const* parameters, int pcnt, User *user)
{
if (pcnt >= 3)
{
diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp
index 43483fa17..29433ff5a 100644
--- a/src/commands/cmd_quit.cpp
+++ b/src/commands/cmd_quit.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandQuit(Instance);
}
-CmdResult CommandQuit::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandQuit::Handle (const char* const* parameters, int pcnt, User *user)
{
std::string quitmsg;
diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp
index d0e1882a7..760689eb0 100644
--- a/src/commands/cmd_rehash.cpp
+++ b/src/commands/cmd_rehash.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandRehash(Instance);
}
-CmdResult CommandRehash::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandRehash::Handle (const char* const* parameters, int pcnt, User *user)
{
user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName));
std::string parameter;
diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp
index b5b6cbef4..015160257 100644
--- a/src/commands/cmd_reloadmodule.cpp
+++ b/src/commands/cmd_reloadmodule.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandReloadmodule(Instance);
}
-CmdResult CommandReloadmodule::Handle (const char** parameters, int, User *user)
+CmdResult CommandReloadmodule::Handle (const char* const* parameters, int, User *user)
{
if (ServerInstance->Modules->Unload(parameters[0]))
{
diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp
index b22bb774b..379052a1e 100644
--- a/src/commands/cmd_restart.cpp
+++ b/src/commands/cmd_restart.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandRestart(Instance);
}
-CmdResult CommandRestart::Handle (const char** parameters, int, User *user)
+CmdResult CommandRestart::Handle (const char* const* parameters, int, User *user)
{
ServerInstance->Log(DEFAULT,"Restart: %s",user->nick);
if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0], ServerInstance->Config->powerhash))
diff --git a/src/commands/cmd_rules.cpp b/src/commands/cmd_rules.cpp
index d38e5eefc..685d04389 100644
--- a/src/commands/cmd_rules.cpp
+++ b/src/commands/cmd_rules.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandRules(Instance);
}
-CmdResult CommandRules::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandRules::Handle (const char* const* parameters, int pcnt, User *user)
{
user->ShowRULES();
return CMD_SUCCESS;
diff --git a/src/commands/cmd_server.cpp b/src/commands/cmd_server.cpp
index 282f4eec5..f4c12f7e3 100644
--- a/src/commands/cmd_server.cpp
+++ b/src/commands/cmd_server.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandServer(Instance);
}
-CmdResult CommandServer::Handle (const char**, int, User *user)
+CmdResult CommandServer::Handle (const char* const*, int, User *user)
{
user->WriteServ("666 %s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick);
ServerInstance->SNO->WriteToSnoMask('A', "WARNING: %s attempted to issue a SERVER command and is registered as a user!", user->nick);
diff --git a/src/commands/cmd_squit.cpp b/src/commands/cmd_squit.cpp
index f51bc42b9..e98790380 100644
--- a/src/commands/cmd_squit.cpp
+++ b/src/commands/cmd_squit.cpp
@@ -24,7 +24,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandSquit(Instance);
}
-CmdResult CommandSquit::Handle (const char**, int, User *user)
+CmdResult CommandSquit::Handle (const char* const*, int, User *user)
{
user->WriteServ( "NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick);
return CMD_FAILURE;
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 72bdc69bd..f2292c2e0 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -31,7 +31,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandStats(Instance);
}
-CmdResult CommandStats::Handle (const char** parameters, int /* pcnt */, User *user)
+CmdResult CommandStats::Handle (const char* const* parameters, int /* pcnt */, User *user)
{
if (IS_LOCAL(user))
{
diff --git a/src/commands/cmd_time.cpp b/src/commands/cmd_time.cpp
index f5bb86b3d..a62d46d7a 100644
--- a/src/commands/cmd_time.cpp
+++ b/src/commands/cmd_time.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandTime(Instance);
}
-CmdResult CommandTime::Handle (const char**, int, User *user)
+CmdResult CommandTime::Handle (const char* const*, int, User *user)
{
struct tm* timeinfo;
time_t local = ServerInstance->Time();
diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp
index 3e7f23c65..46c26806f 100644
--- a/src/commands/cmd_topic.cpp
+++ b/src/commands/cmd_topic.cpp
@@ -20,7 +20,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandTopic(Instance);
}
-CmdResult CommandTopic::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *user)
{
Channel* Ptr;
diff --git a/src/commands/cmd_trace.cpp b/src/commands/cmd_trace.cpp
index 1b7f83694..5480c03a5 100644
--- a/src/commands/cmd_trace.cpp
+++ b/src/commands/cmd_trace.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** XXX: This is crap. someone fix this when you have time, to be more useful.
*/
-CmdResult CommandTrace::Handle (const char**, int, User *user)
+CmdResult CommandTrace::Handle (const char* const*, int, User *user)
{
/*for (user_hash::iterator i = ServerInstance->clientlist->begin(); i != ServerInstance->clientlist->end(); i++)
{
diff --git a/src/commands/cmd_unloadmodule.cpp b/src/commands/cmd_unloadmodule.cpp
index 6d95ee656..a01623b64 100644
--- a/src/commands/cmd_unloadmodule.cpp
+++ b/src/commands/cmd_unloadmodule.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandUnloadmodule(Instance);
}
-CmdResult CommandUnloadmodule::Handle (const char** parameters, int, User *user)
+CmdResult CommandUnloadmodule::Handle (const char* const* parameters, int, User *user)
{
if (ServerInstance->Modules->Unload(parameters[0]))
{
diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp
index be49deeac..8f056d83f 100644
--- a/src/commands/cmd_user.cpp
+++ b/src/commands/cmd_user.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandUser(Instance);
}
-CmdResult CommandUser::Handle (const char** parameters, int, User *user)
+CmdResult CommandUser::Handle (const char* const* parameters, int, User *user)
{
/* A user may only send the USER command once */
if (!(user->registered & REG_USER))
diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp
index d6b34456f..c8a33535f 100644
--- a/src/commands/cmd_userhost.cpp
+++ b/src/commands/cmd_userhost.cpp
@@ -19,7 +19,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandUserhost(Instance);
}
-CmdResult CommandUserhost::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandUserhost::Handle (const char* const* parameters, int pcnt, User *user)
{
std::string retbuf = std::string("302 ") + user->nick + " :";
diff --git a/src/commands/cmd_version.cpp b/src/commands/cmd_version.cpp
index b65c885f7..51e9e771a 100644
--- a/src/commands/cmd_version.cpp
+++ b/src/commands/cmd_version.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandVersion(Instance);
}
-CmdResult CommandVersion::Handle (const char**, int, User *user)
+CmdResult CommandVersion::Handle (const char* const*, int, User *user)
{
user->WriteServ("351 %s :%s",user->nick,ServerInstance->GetVersionString().c_str());
ServerInstance->Config->Send005(user);
diff --git a/src/commands/cmd_wallops.cpp b/src/commands/cmd_wallops.cpp
index 0283122cd..cd8995ad8 100644
--- a/src/commands/cmd_wallops.cpp
+++ b/src/commands/cmd_wallops.cpp
@@ -21,7 +21,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandWallops(Instance);
}
-CmdResult CommandWallops::Handle (const char** parameters, int, User *user)
+CmdResult CommandWallops::Handle (const char* const* parameters, int, User *user)
{
user->WriteWallOps(std::string(parameters[0]));
FOREACH_MOD(I_OnWallops,OnWallops(user,parameters[0]));
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index a54623672..d26cd918d 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -165,7 +165,7 @@ void CommandWho::SendWhoLine(User* user, const std::string &initial, Channel* ch
whoresults.push_back(wholine);
}
-CmdResult CommandWho::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandWho::Handle (const char* const* parameters, int pcnt, User *user)
{
/*
* XXX - RFC says:
diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp
index 11456ca1b..889fa3e71 100644
--- a/src/commands/cmd_whois.cpp
+++ b/src/commands/cmd_whois.cpp
@@ -91,7 +91,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandWhois(Instance);
}
-CmdResult CommandWhois::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandWhois::Handle (const char* const* parameters, int pcnt, User *user)
{
User *dest;
int userindex = 0;
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp
index 7b44a0290..fd9544853 100644
--- a/src/commands/cmd_whowas.cpp
+++ b/src/commands/cmd_whowas.cpp
@@ -28,7 +28,7 @@ CommandWhowas::CommandWhowas(InspIRCd* Instance) : Command(Instance, "WHOWAS", 0
Instance->Timers->AddTimer(timer);
}
-CmdResult CommandWhowas::Handle (const char** parameters, int, User* user)
+CmdResult CommandWhowas::Handle (const char* const* parameters, int, User* user)
{
/* if whowas disabled in config */
if (ServerInstance->Config->WhoWasGroupSize == 0 || ServerInstance->Config->WhoWasMaxGroups == 0)
diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp
index 2a12ee5b5..c4bc750c7 100644
--- a/src/commands/cmd_zline.cpp
+++ b/src/commands/cmd_zline.cpp
@@ -22,7 +22,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandZline(Instance);
}
-CmdResult CommandZline::Handle (const char** parameters, int pcnt, User *user)
+CmdResult CommandZline::Handle (const char* const* parameters, int pcnt, User *user)
{
std::string target = parameters[0];