summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/cmd_admin.cpp2
-rw-r--r--src/commands/cmd_away.cpp7
-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.cpp4
-rw-r--r--src/commands/cmd_eline.cpp8
-rw-r--r--src/commands/cmd_gline.cpp10
-rw-r--r--src/commands/cmd_info.cpp2
-rw-r--r--src/commands/cmd_invite.cpp16
-rw-r--r--src/commands/cmd_ison.cpp6
-rw-r--r--src/commands/cmd_join.cpp18
-rw-r--r--src/commands/cmd_kick.cpp12
-rw-r--r--src/commands/cmd_kill.cpp20
-rw-r--r--src/commands/cmd_kline.cpp10
-rw-r--r--src/commands/cmd_links.cpp2
-rw-r--r--src/commands/cmd_list.cpp18
-rw-r--r--src/commands/cmd_loadmodule.cpp10
-rw-r--r--src/commands/cmd_lusers.cpp2
-rw-r--r--src/commands/cmd_map.cpp2
-rw-r--r--src/commands/cmd_mode.cpp4
-rw-r--r--src/commands/cmd_modules.cpp2
-rw-r--r--src/commands/cmd_motd.cpp2
-rw-r--r--src/commands/cmd_names.cpp8
-rw-r--r--src/commands/cmd_nick.cpp34
-rw-r--r--src/commands/cmd_notice.cpp23
-rw-r--r--src/commands/cmd_oper.cpp16
-rw-r--r--src/commands/cmd_part.cpp10
-rw-r--r--src/commands/cmd_pass.cpp8
-rw-r--r--src/commands/cmd_ping.cpp4
-rw-r--r--src/commands/cmd_pong.cpp2
-rw-r--r--src/commands/cmd_privmsg.cpp31
-rw-r--r--src/commands/cmd_qline.cpp22
-rw-r--r--src/commands/cmd_quit.cpp6
-rw-r--r--src/commands/cmd_rehash.cpp11
-rw-r--r--src/commands/cmd_reloadmodule.cpp16
-rw-r--r--src/commands/cmd_restart.cpp4
-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.cpp4
-rw-r--r--src/commands/cmd_time.cpp2
-rw-r--r--src/commands/cmd_topic.cpp16
-rw-r--r--src/commands/cmd_trace.cpp2
-rw-r--r--src/commands/cmd_unloadmodule.cpp10
-rw-r--r--src/commands/cmd_user.cpp8
-rw-r--r--src/commands/cmd_userhost.cpp4
-rw-r--r--src/commands/cmd_version.cpp2
-rw-r--r--src/commands/cmd_wallops.cpp2
-rw-r--r--src/commands/cmd_who.cpp19
-rw-r--r--src/commands/cmd_whois.cpp16
-rw-r--r--src/commands/cmd_whowas.cpp22
-rw-r--r--src/commands/cmd_zline.cpp12
53 files changed, 237 insertions, 246 deletions
diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp
index bc443fc32..5e9b4b4c7 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* const* parameters, int pcnt, User *user)
+CmdResult CommandAdmin::Handle (const std::vector<std::string>& parameters, User *user)
{
user->WriteNumeric(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 33e140beb..7d2522304 100644
--- a/src/commands/cmd_away.cpp
+++ b/src/commands/cmd_away.cpp
@@ -21,11 +21,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /AWAY
*/
-CmdResult CommandAway::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User *user)
{
int MOD_RESULT = 0;
- if ((pcnt) && (*parameters[0]))
+ if ((parameters.size()) && (!parameters[0].empty()))
{
FOREACH_RESULT(I_OnSetAway, OnSetAway(user, parameters[0]));
@@ -33,7 +33,8 @@ CmdResult CommandAway::Handle (const char* const* parameters, int pcnt, User *us
return CMD_FAILURE;
user->awaytime = ServerInstance->Time();
- strlcpy(user->awaymsg,parameters[0],MAXAWAY);
+ strlcpy(user->awaymsg, parameters[0].c_str(), MAXAWAY);
+
user->WriteNumeric(306, "%s :You have been marked as being away",user->nick);
}
else
diff --git a/src/commands/cmd_clearcache.cpp b/src/commands/cmd_clearcache.cpp
index c7354df07..5f1792928 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* const* parameters, int pcnt, User *user)
+CmdResult CommandClearcache::Handle (const std::vector<std::string>& parameters, 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 2b2e7ffa0..eddcb6bd8 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* const*, int, User *user)
+CmdResult CommandCommands::Handle (const std::vector<std::string>&, 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 04aada207..81340c37a 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* const*, int, User *user)
+CmdResult CommandConnect::Handle (const std::vector<std::string>&, 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 2723ecca3..4278a3a90 100644
--- a/src/commands/cmd_die.cpp
+++ b/src/commands/cmd_die.cpp
@@ -22,9 +22,9 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /DIE
*/
-CmdResult CommandDie::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandDie::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0], ServerInstance->Config->powerhash))
+ if (!ServerInstance->PassCompare(user, ServerInstance->Config->diepass, parameters[0].c_str(), ServerInstance->Config->powerhash))
{
{
std::string diebuf = std::string("*** DIE command from ") + user->nick + "!" + user->ident + "@" + user->dhost + ". Terminating in " + ConvToStr(ServerInstance->Config->DieDelay) + " seconds.";
diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp
index fa9ddd708..57f0e193c 100644
--- a/src/commands/cmd_eline.cpp
+++ b/src/commands/cmd_eline.cpp
@@ -22,11 +22,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /ELINE
*/
-CmdResult CommandEline::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string target = parameters[0];
- if (pcnt >= 3)
+ if (parameters.size() >= 3)
{
IdentHostPair ih;
User* find = ServerInstance->FindNick(target.c_str());
@@ -48,9 +48,9 @@ CmdResult CommandEline::Handle (const char* const* parameters, int pcnt, User *u
if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
return CMD_FAILURE;
- long duration = ServerInstance->Duration(parameters[1]);
+ long duration = ServerInstance->Duration(parameters[1].c_str());
- ELine* el = new ELine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str());
+ ELine* el = new ELine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
if (ServerInstance->XLines->AddLine(el, user))
{
if (!duration)
diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp
index a6bec9c0e..d2a1f69d6 100644
--- a/src/commands/cmd_gline.cpp
+++ b/src/commands/cmd_gline.cpp
@@ -22,11 +22,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /GLINE
*/
-CmdResult CommandGline::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string target = parameters[0];
- if (pcnt >= 3)
+ if (parameters.size() >= 3)
{
IdentHostPair ih;
User* find = ServerInstance->FindNick(target.c_str());
@@ -48,14 +48,14 @@ CmdResult CommandGline::Handle (const char* const* parameters, int pcnt, User *u
if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
return CMD_FAILURE;
- else if (strchr(target.c_str(),'!'))
+ else if (target.find('!') != std::string::npos)
{
user->WriteServ("NOTICE %s :*** G-Line cannot operate on nick!user@host masks",user->nick);
return CMD_FAILURE;
}
- long duration = ServerInstance->Duration(parameters[1]);
- GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str());
+ long duration = ServerInstance->Duration(parameters[1].c_str());
+ GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
if (ServerInstance->XLines->AddLine(gl, user))
{
if (!duration)
diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp
index 31f98ddfe..346168960 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* const*, int, User *user)
+CmdResult CommandInfo::Handle (const std::vector<std::string>&, 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 553915ac9..db1c64eac 100644
--- a/src/commands/cmd_invite.cpp
+++ b/src/commands/cmd_invite.cpp
@@ -21,31 +21,23 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /INVITE
*/
-CmdResult CommandInvite::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, User *user)
{
int MOD_RESULT = 0;
- if (pcnt == 2 || pcnt == 3)
+ if (parameters.size() == 2 || parameters.size() == 3)
{
User* u = ServerInstance->FindNick(parameters[0]);
Channel* c = ServerInstance->FindChan(parameters[1]);
time_t timeout = 0;
- if (pcnt == 3)
+ if (parameters.size() == 3)
{
timeout = time(NULL) + ServerInstance->Duration(parameters[2]);
}
if ((!c) || (!u))
{
- if (!c)
- {
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[1]);
- }
- else
- {
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
- }
-
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, c ? parameters[0].c_str() : parameters[1].c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_ison.cpp b/src/commands/cmd_ison.cpp
index ba119e251..3c2ebad58 100644
--- a/src/commands/cmd_ison.cpp
+++ b/src/commands/cmd_ison.cpp
@@ -21,13 +21,13 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /ISON
*/
-CmdResult CommandIson::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandIson::Handle (const std::vector<std::string>& parameters, User *user)
{
std::map<User*,User*> ison_already;
User *u;
std::string reply = std::string("303 ") + user->nick + " :";
- for (int i = 0; i < pcnt; i++)
+ for (unsigned int i = 0; i < parameters.size(); i++)
{
u = ServerInstance->FindNick(parameters[i]);
if (ison_already.find(u) != ison_already.end())
@@ -48,7 +48,7 @@ CmdResult CommandIson::Handle (const char* const* parameters, int pcnt, User *us
}
else
{
- if ((i == pcnt-1) && (strchr(parameters[i],' ')))
+ if ((i == parameters.size() - 1) && (parameters[i].find(' ') != std::string::npos))
{
/* Its a space seperated list of nicks (RFC1459 says to support this)
*/
diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp
index d34409e7c..e7c841399 100644
--- a/src/commands/cmd_join.cpp
+++ b/src/commands/cmd_join.cpp
@@ -21,31 +21,31 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /JOIN
*/
-CmdResult CommandJoin::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (pcnt > 1)
+ if (parameters.size() > 1)
{
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0, 1))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, 0, 1))
return CMD_SUCCESS;
- if (ServerInstance->IsChannel(parameters[0]))
+ if (ServerInstance->IsChannel(parameters[0].c_str()))
{
- Channel::JoinUser(ServerInstance, user, parameters[0], false, parameters[1], false);
+ Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, parameters[1].c_str(), false);
return CMD_SUCCESS;
}
}
else
{
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
return CMD_SUCCESS;
- if (ServerInstance->IsChannel(parameters[0]))
+ if (ServerInstance->IsChannel(parameters[0].c_str()))
{
- Channel::JoinUser(ServerInstance, user, parameters[0], false, "", false);
+ Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, "", false);
return CMD_SUCCESS;
}
}
- user->WriteNumeric(403, "%s %s :Invalid channel name",user->nick, parameters[0]);
+ user->WriteNumeric(403, "%s %s :Invalid channel name",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_kick.cpp b/src/commands/cmd_kick.cpp
index 9cf4f8b5c..e4acbbbf1 100644
--- a/src/commands/cmd_kick.cpp
+++ b/src/commands/cmd_kick.cpp
@@ -21,30 +21,30 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /KICK
*/
-CmdResult CommandKick::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User *user)
{
char reason[MAXKICK];
Channel* c = ServerInstance->FindChan(parameters[0]);
User* u = ServerInstance->FindNick(parameters[1]);
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 1))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 1))
return CMD_SUCCESS;
if (!u || !c)
{
- user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]);
+ user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0].c_str() : parameters[1].c_str());
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]);
+ user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
- if (pcnt > 2)
+ if (parameters.size() > 2)
{
- strlcpy(reason, parameters[2], MAXKICK - 1);
+ strlcpy(reason, parameters[2].c_str(), MAXKICK - 1);
}
else
{
diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp
index 6932c8ed6..0d95b1cf0 100644
--- a/src/commands/cmd_kill.cpp
+++ b/src/commands/cmd_kill.cpp
@@ -21,10 +21,10 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /KILL
*/
-CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User *user)
{
/* Allow comma seperated lists of users for /KILL (thanks w00t) */
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 0))
return CMD_SUCCESS;
User *u = ServerInstance->FindNick(parameters[0]);
@@ -54,18 +54,18 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
if (*ServerInstance->Config->HideKillsServer)
{
// hidekills is on, use it
- snprintf(killreason, MAXQUIT, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1]);
+ snprintf(killreason, MAXQUIT, "Killed (%s (%s))", ServerInstance->Config->HideKillsServer, parameters[1].c_str());
}
else
{
// hidekills is off, do nothing
- snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1]);
+ snprintf(killreason, MAXQUIT, "Killed (%s (%s))", user->nick, parameters[1].c_str());
}
}
else
{
/* Leave it alone, remote server has already formatted it */
- snprintf(killreason, MAXQUIT, "%s", parameters[1]);
+ strlcpy(killreason, parameters[1].c_str(), MAXQUIT);
}
/*
@@ -75,7 +75,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
if (!IS_LOCAL(u))
{
// remote kill
- ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
+ ServerInstance->SNO->WriteToSnoMask('K', "Remote kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1].c_str());
FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason, killreason));
}
else
@@ -85,8 +85,8 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
* XXX - this isn't entirely correct, servers A - B - C, oper on A, client on C. Oper kills client, A and B will get remote kill
* snotices, C will get a local kill snotice. this isn't accurate, and needs fixing at some stage. -- w00t
*/
- ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]);
- ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1]);
+ ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1].c_str());
+ ServerInstance->Logs->Log("KILL",DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerInstance->Config->ServerName, user->dhost, user->nick, parameters[1].c_str());
/* Bug #419, make sure this message can only occur once even in the case of multiple KILL messages crossing the network, and change to show
* hidekillsserver as source if possible
*/
@@ -97,7 +97,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
ServerInstance->Config->ServerName,
user->dhost,
*ServerInstance->Config->HideKillsServer ? ServerInstance->Config->HideKillsServer : user->nick,
- parameters[1]);
+ parameters[1].c_str());
}
}
@@ -106,7 +106,7 @@ CmdResult CommandKill::Handle (const char* const* parameters, int pcnt, User *us
}
else
{
- user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0]);
+ user->WriteServ( "401 %s %s :No such nick/channel", user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp
index b4464a6d3..ddf5d218b 100644
--- a/src/commands/cmd_kline.cpp
+++ b/src/commands/cmd_kline.cpp
@@ -22,11 +22,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /KLINE
*/
-CmdResult CommandKline::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string target = parameters[0];
- if (pcnt >= 3)
+ if (parameters.size() >= 3)
{
IdentHostPair ih;
User* find = ServerInstance->FindNick(target.c_str());
@@ -48,14 +48,14 @@ CmdResult CommandKline::Handle (const char* const* parameters, int pcnt, User *u
if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
return CMD_FAILURE;
- if (strchr(target.c_str(),'!'))
+ if (target.find('!') != std::string::npos)
{
user->WriteServ("NOTICE %s :*** K-Line cannot operate on nick!user@host masks",user->nick);
return CMD_FAILURE;
}
- long duration = ServerInstance->Duration(parameters[1]);
- KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ih.first.c_str(), ih.second.c_str());
+ long duration = ServerInstance->Duration(parameters[1].c_str());
+ KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
if (ServerInstance->XLines->AddLine(kl,user))
{
if (!duration)
diff --git a/src/commands/cmd_links.cpp b/src/commands/cmd_links.cpp
index e3111831e..554e6d962 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* const*, int, User *user)
+CmdResult CommandLinks::Handle (const std::vector<std::string>&, User *user)
{
user->WriteNumeric(364, "%s %s %s :0 %s",user->nick,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc);
user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick);
diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp
index 2c7971edd..518aee62f 100644
--- a/src/commands/cmd_list.cpp
+++ b/src/commands/cmd_list.cpp
@@ -22,24 +22,22 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandList(Instance);
}
-CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User *user)
{
int minusers = 0, maxusers = 0;
user->WriteNumeric(321, "%s Channel :Users Name",user->nick);
/* Work around mIRC suckyness. YOU SUCK, KHALED! */
- if (pcnt == 1)
+ if (parameters.size() == 1)
{
- if (*parameters[0] == '<')
+ if (parameters[0][0] == '<')
{
- maxusers = atoi(parameters[0]+1);
- pcnt = 0;
+ maxusers = atoi((parameters[0].c_str())+1);
}
- else if (*parameters[0] == '>')
+ else if (parameters[0][0] == '>')
{
- minusers = atoi(parameters[0]+1);
- pcnt = 0;
+ minusers = atoi((parameters[0].c_str())+1);
}
}
@@ -54,9 +52,9 @@ CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *us
if (too_many || too_few)
continue;
- if (pcnt)
+ if (parameters.size() && parameters[0][0] != '<' && parameters[0][0] == '>')
{
- if (!match(i->second->name, parameters[0]) && !match(i->second->topic, parameters[0]))
+ if (!match(i->second->name, parameters[0].c_str()) && !match(i->second->topic, parameters[0].c_str()))
continue;
}
diff --git a/src/commands/cmd_loadmodule.cpp b/src/commands/cmd_loadmodule.cpp
index 744928a86..31bb02ca0 100644
--- a/src/commands/cmd_loadmodule.cpp
+++ b/src/commands/cmd_loadmodule.cpp
@@ -21,17 +21,17 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /LOADMODULE
*/
-CmdResult CommandLoadmodule::Handle (const char* const* parameters, int, User *user)
+CmdResult CommandLoadmodule::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (ServerInstance->Modules->Load(parameters[0]))
+ if (ServerInstance->Modules->Load(parameters[0].c_str()))
{
- ServerInstance->SNO->WriteToSnoMask('A', "NEW MODULE: %s loaded %s",user->nick, parameters[0]);
- user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick, parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('A', "NEW MODULE: %s loaded %s",user->nick, parameters[0].c_str());
+ user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick, parameters[0].c_str());
return CMD_SUCCESS;
}
else
{
- user->WriteNumeric(974, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str());
+ user->WriteNumeric(974, "%s %s :%s",user->nick, parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
return CMD_FAILURE;
}
}
diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp
index 313e2d2b5..11f34d8d7 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* const*, int, User *user)
+CmdResult CommandLusers::Handle (const std::vector<std::string>&, 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 5e729c98c..cea9f39cf 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* const*, int, User *user)
+CmdResult CommandMap::Handle (const std::vector<std::string>&, 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 25fec59b9..7bc417fd1 100644
--- a/src/commands/cmd_mode.cpp
+++ b/src/commands/cmd_mode.cpp
@@ -21,9 +21,9 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /MODE
*/
-CmdResult CommandMode::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandMode::Handle (const std::vector<std::string>& parameters, User *user)
{
- ServerInstance->Modes->Process(parameters, pcnt, user, false);
+ ServerInstance->Modes->Process(parameters, user, false);
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 4e4679ce4..0409e6341 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* const*, int, User *user)
+CmdResult CommandModules::Handle (const std::vector<std::string>&, 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 b6584303d..b2f909f90 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* const*, int, User *user)
+CmdResult CommandMotd::Handle (const std::vector<std::string>&, User *user)
{
user->ShowMOTD();
return CMD_SUCCESS;
diff --git a/src/commands/cmd_names.cpp b/src/commands/cmd_names.cpp
index 0c3492630..7e2b9cdee 100644
--- a/src/commands/cmd_names.cpp
+++ b/src/commands/cmd_names.cpp
@@ -21,17 +21,17 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
/** Handle /NAMES
*/
-CmdResult CommandNames::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User *user)
{
Channel* c;
- if (!pcnt)
+ if (!parameters.size())
{
user->WriteNumeric(366, "%s * :End of /NAMES list.",user->nick);
return CMD_SUCCESS;
}
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
return CMD_SUCCESS;
c = ServerInstance->FindChan(parameters[0]);
@@ -46,7 +46,7 @@ CmdResult CommandNames::Handle (const char* const* parameters, int pcnt, User *u
}
else
{
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
}
return CMD_SUCCESS;
diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp
index 059a97806..eac29dd24 100644
--- a/src/commands/cmd_nick.cpp
+++ b/src/commands/cmd_nick.cpp
@@ -25,21 +25,21 @@ 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* const* parameters, int, User *user)
+CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User *user)
{
char oldnick[NICKMAX];
- if (!*parameters[0] || !*user->nick)
+ if (parameters[0].empty())
{
/* We cant put blanks in the parameters, so for this (extremely rare) issue we just put '*' here. */
user->WriteNumeric(432, "%s * :Erroneous Nickname", *user->nick ? user->nick : "*");
return CMD_FAILURE;
}
- if (irc::string(user->nick) == irc::string(parameters[0]))
+ if (irc::string(user->nick) == assign(parameters[0]))
{
/* If its exactly the same, even case, dont do anything. */
- if (!strcmp(user->nick,parameters[0]))
+ if (parameters[0] == user->nick)
return CMD_SUCCESS;
/* Its a change of case. People insisted that they should be
@@ -48,12 +48,12 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
*/
strlcpy(oldnick, user->nick, NICKMAX - 1);
int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0].c_str()));
if (MOD_RESULT)
return CMD_FAILURE;
if (user->registered == REG_ALL)
- user->WriteCommon("NICK %s",parameters[0]);
- strlcpy(user->nick, parameters[0], NICKMAX - 1);
+ user->WriteCommon("NICK %s",parameters[0].c_str());
+ strlcpy(user->nick, parameters[0].c_str(), NICKMAX - 1);
user->InvalidateCache();
FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
return CMD_SUCCESS;
@@ -73,8 +73,8 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
XLine* mq = ServerInstance->XLines->MatchesLine("Q",parameters[0]);
if (mq)
{
- ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0], user->nick, user->ident, user->host, mq->reason);
- user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason);
+ ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0].c_str(), user->nick, user->ident, user->host, mq->reason);
+ user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick, parameters[0].c_str(), mq->reason);
return CMD_FAILURE;
}
}
@@ -89,7 +89,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
* because the nick is already (rightfully) in use. -- w00t
*/
User* InUse = ServerInstance->FindNickOnly(parameters[0]);
- if (InUse && (InUse != user) && ((ServerInstance->IsNick(parameters[0]) || allowinvalid)))
+ if (InUse && (InUse != user) && ((ServerInstance->IsNick(parameters[0].c_str()) || allowinvalid)))
{
if (InUse->registered != REG_ALL)
{
@@ -104,33 +104,33 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
else
{
/* No camping, tell the incoming user to stop trying to change nick ;p */
- user->WriteNumeric(433, "%s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]);
+ user->WriteNumeric(433, "%s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0].c_str());
return CMD_FAILURE;
}
}
}
- if (((!ServerInstance->IsNick(parameters[0]))) && (IS_LOCAL(user)))
+ if (((!ServerInstance->IsNick(parameters[0].c_str()))) && (IS_LOCAL(user)))
{
if (!allowinvalid)
{
- user->WriteNumeric(432, "%s %s :Erroneous Nickname",user->nick,parameters[0]);
+ user->WriteNumeric(432, "%s %s :Erroneous Nickname", user->nick,parameters[0].c_str());
return CMD_FAILURE;
}
}
int MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
+ FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user, parameters[0]));
if (MOD_RESULT)
// if a module returns true, the nick change is silently forbidden.
return CMD_FAILURE;
if (user->registered == REG_ALL)
- user->WriteCommon("NICK %s",parameters[0]);
+ user->WriteCommon("NICK %s", parameters[0].c_str());
strlcpy(oldnick, user->nick, NICKMAX - 1);
/* change the nick of the user in the users_hash */
- user = user->UpdateNickHash(parameters[0]);
+ user = user->UpdateNickHash(parameters[0].c_str());
/* actually change the nick within the record */
if (!user)
@@ -138,7 +138,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
if (!*user->nick)
return CMD_FAILURE;
- strlcpy(user->nick, parameters[0], NICKMAX - 1);
+ strlcpy(user->nick, parameters[0].c_str(), NICKMAX - 1);
user->InvalidateCache();
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index 1a47b56fb..d6e11a803 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* const* parameters, int pcnt, User *user)
+CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, User *user)
{
User *dest;
Channel *chan;
@@ -29,28 +29,29 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
user->idle_lastmsg = ServerInstance->Time();
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 0))
return CMD_SUCCESS;
if ((parameters[0][0] == '$') && (IS_OPER(user) || 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,exempt_list));
+ FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list));
if (MOD_RESULT)
return CMD_FAILURE;
const char* text = temp.c_str();
- const char* servermask = parameters[0] + 1;
+ const char* servermask = (parameters[0].c_str()) + 1;
- FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,text,0,exempt_list));
+ FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, exempt_list));
if (match(ServerInstance->Config->ServerName,servermask))
{
user->SendAll("NOTICE", "%s", text);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,text,0,exempt_list));
+ FOREACH_MOD(I_OnUserNotice,OnUserNotice(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, exempt_list));
return CMD_SUCCESS;
}
char status = 0;
- const char* target = parameters[0];
+ const char* target = parameters[0].c_str();
+
if (ServerInstance->Modes->FindPrefix(*target))
{
status = *target;
@@ -121,7 +122,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
return CMD_SUCCESS;
}
- const char* destnick = parameters[0];
+ const char* destnick = parameters[0].c_str();
if (IS_LOCAL(user))
{
@@ -135,7 +136,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
if (dest && strcasecmp(dest->server, targetserver + 1))
{
/* Incorrect server for user */
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
}
@@ -147,7 +148,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
if (dest)
{
- if (!*parameters[1])
+ if (parameters[1].empty())
{
user->WriteNumeric(412, "%s :No text to send", user->nick);
return CMD_FAILURE;
@@ -174,7 +175,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User *
else
{
/* no such nick/channel */
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp
index 0b17c4dca..a397f5b0d 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* const* parameters, int, User *user)
+CmdResult CommandOper::Handle (const std::vector<std::string>& parameters, User *user)
{
char LoginName[MAXBUF];
char Password[MAXBUF];
@@ -65,8 +65,8 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "host", i, HostName, MAXBUF);
ServerInstance->Config->ConfValue(ServerInstance->Config->config_data, "oper", "hash", i, HashType, MAXBUF);
- match_login = !strcmp(LoginName,parameters[0]);
- match_pass = !ServerInstance->PassCompare(user, Password,parameters[1], HashType);
+ match_login = (LoginName == parameters[0]);
+ match_pass = !ServerInstance->PassCompare(user, Password,parameters[1].c_str(), HashType);
match_hosts = OneOfMatches(TheHost,TheIP,HostName);
if (match_login && match_pass && match_hosts)
@@ -107,7 +107,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
if (found)
{
/* correct oper credentials */
- ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0].c_str());
user->WriteNumeric(381, "%s :You are now %s %s",user->nick, strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType));
if (!user->IsModeSet('o'))
user->Oper(OperType, LoginName);
@@ -133,21 +133,21 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user)
user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick);
user->IncreasePenalty(10);
- snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s",user->nick,user->ident,user->host, parameters[0], fields.c_str());
+ snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s",user->nick,user->ident,user->host, parameters[0].c_str(), fields.c_str());
ServerInstance->SNO->WriteToSnoMask('o',std::string(broadcast));
- ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0],fields.c_str());
+ ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': The following fields did not match: %s",user->nick,user->ident,user->host,parameters[0].c_str(),fields.c_str());
return CMD_FAILURE;
}
else
{
user->WriteNumeric(491, "%s :Your oper block does not have a valid opertype associated with it",user->nick);
- snprintf(broadcast, MAXBUF, "CONFIGURATION ERROR! Oper block '%s': missing OperType %s",parameters[0],OperType);
+ snprintf(broadcast, MAXBUF, "CONFIGURATION ERROR! Oper block '%s': missing OperType %s",parameters[0].c_str(),OperType);
ServerInstance->SNO->WriteToSnoMask('o', std::string(broadcast));
- ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0]);
+ ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s using login '%s': credentials valid, but oper type nonexistent.",user->nick,user->ident,user->host,parameters[0].c_str());
return CMD_FAILURE;
}
}
diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp
index 360287c45..07b45367f 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* const* parameters, int pcnt, User *user)
+CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string reason;
@@ -29,7 +29,7 @@ CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *us
reason = ServerInstance->Config->FixedPart;
else
{
- if (pcnt > 1)
+ if (parameters.size() > 1)
reason = ServerInstance->Config->PrefixPart + std::string(parameters[1]) + ServerInstance->Config->SuffixPart;
else
reason = "";
@@ -37,10 +37,10 @@ CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *us
}
else
{
- reason = pcnt > 1 ? parameters[1] : "";
+ reason = parameters.size() > 1 ? parameters[1] : "";
}
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
return CMD_SUCCESS;
Channel* c = ServerInstance->FindChan(parameters[0]);
@@ -54,7 +54,7 @@ CmdResult CommandPart::Handle (const char* const* parameters, int pcnt, User *us
}
else
{
- user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0]);
+ user->WriteServ( "401 %s %s :No such channel", user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp
index 2333661e7..2e1a702a2 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* const* parameters, int, User *user)
+CmdResult CommandPass::Handle (const std::vector<std::string>& parameters, User *user)
{
// Check to make sure they havnt registered -- Fix by FCS
if (user->registered == REG_ALL)
@@ -31,11 +31,9 @@ CmdResult CommandPass::Handle (const char* const* parameters, int, User *user)
if (!a)
return CMD_FAILURE;
- strlcpy(user->password,parameters[0],63);
- if (!ServerInstance->PassCompare(user, a->GetPass().c_str(), parameters[0], a->GetHash().c_str()))
- {
+ strlcpy(user->password, parameters[0].c_str(), 63);
+ if (!ServerInstance->PassCompare(user, a->GetPass().c_str(), parameters[0].c_str(), a->GetHash().c_str()))
user->haspassed = true;
- }
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_ping.cpp b/src/commands/cmd_ping.cpp
index 3aeafe15e..38e5d49ab 100644
--- a/src/commands/cmd_ping.cpp
+++ b/src/commands/cmd_ping.cpp
@@ -19,8 +19,8 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandPing(Instance);
}
-CmdResult CommandPing::Handle (const char* const* parameters, int, User *user)
+CmdResult CommandPing::Handle (const std::vector<std::string>& parameters, User *user)
{
- user->WriteServ("PONG %s :%s",ServerInstance->Config->ServerName,parameters[0]);
+ user->WriteServ("PONG %s :%s", ServerInstance->Config->ServerName, parameters[0].c_str());
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_pong.cpp b/src/commands/cmd_pong.cpp
index 51c951eba..7e7cba3b9 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* const*, int, User *user)
+CmdResult CommandPong::Handle (const std::vector<std::string>&, 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 9ce089dc0..a3d64f084 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* const* parameters, int pcnt, User *user)
+CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, User *user)
{
User *dest;
Channel *chan;
@@ -28,28 +28,31 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
user->idle_lastmsg = ServerInstance->Time();
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 0))
return CMD_SUCCESS;
if ((parameters[0][0] == '$') && (IS_OPER(user) || ServerInstance->ULine(user->server)))
{
int MOD_RESULT = 0;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,(void*)parameters[0],TYPE_SERVER,temp,0,except_list));
+ FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list));
if (MOD_RESULT)
return CMD_FAILURE;
+
const char* text = temp.c_str();
- const char* servermask = parameters[0] + 1;
- FOREACH_MOD(I_OnText,OnText(user,(void*)parameters[0],TYPE_SERVER,text,0,except_list));
+ const char* servermask = (parameters[0].c_str()) + 1;
+
+ FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
if (match(ServerInstance->Config->ServerName,servermask))
{
user->SendAll("PRIVMSG", "%s", text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,(void*)parameters[0],TYPE_SERVER,text,0,except_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
return CMD_SUCCESS;
}
char status = 0;
- const char* target = parameters[0];
+ const char* target = parameters[0].c_str();
+
if (ServerInstance->Modes->FindPrefix(*target))
{
status = *target;
@@ -121,7 +124,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
return CMD_SUCCESS;
}
- const char* destnick = parameters[0];
+ const char* destnick = parameters[0].c_str();
if (IS_LOCAL(user))
{
@@ -135,7 +138,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
if (dest && strcasecmp(dest->server, targetserver + 1))
{
/* Incorrect server for user */
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
}
@@ -147,7 +150,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
if (dest)
{
- if (!*parameters[1])
+ if (parameters[1].empty())
{
user->WriteNumeric(412, "%s :No text to send", user->nick);
return CMD_FAILURE;
@@ -162,13 +165,13 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
int MOD_RESULT = 0;
std::string temp = parameters[1];
- FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user,dest,TYPE_USER,temp,0,except_list));
+ FOREACH_RESULT(I_OnUserPreMessage,OnUserPreMessage(user, dest, TYPE_USER, temp, 0, except_list));
if (MOD_RESULT) {
return CMD_FAILURE;
}
const char* text = temp.c_str();
- FOREACH_MOD(I_OnText,OnText(user,dest,TYPE_USER,text,0,except_list));
+ FOREACH_MOD(I_OnText,OnText(user, dest, TYPE_USER, text, 0, except_list));
if (IS_LOCAL(dest))
{
@@ -176,12 +179,12 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User
user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick, text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,dest,TYPE_USER,text,0,except_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list));
}
else
{
/* no such nick/channel */
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
return CMD_SUCCESS;
diff --git a/src/commands/cmd_qline.cpp b/src/commands/cmd_qline.cpp
index 97d26ba9f..f3471a6b3 100644
--- a/src/commands/cmd_qline.cpp
+++ b/src/commands/cmd_qline.cpp
@@ -22,31 +22,31 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandQline(Instance);
}
-CmdResult CommandQline::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (pcnt >= 3)
+ if (parameters.size() >= 3)
{
if (ServerInstance->NickMatchesEveryone(parameters[0],user))
return CMD_FAILURE;
- if (strchr(parameters[0],'@') || strchr(parameters[0],'!') || strchr(parameters[0],'.'))
+ if (parameters[0].find('@') != std::string::npos || parameters[0].find('!') != std::string::npos || parameters[0].find('.') != std::string::npos)
{
user->WriteServ("NOTICE %s :*** A Q-Line only bans a nick pattern, not a nick!user@host pattern.",user->nick);
return CMD_FAILURE;
}
- long duration = ServerInstance->Duration(parameters[1]);
- QLine* ql = new QLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]);
+ long duration = ServerInstance->Duration(parameters[1].c_str());
+ QLine* ql = new QLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), parameters[0].c_str());
if (ServerInstance->XLines->AddLine(ql,user))
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0].c_str());
}
else
{
time_t c_requires_crap = duration + ServerInstance->Time();
- ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s",user->nick,parameters[0],
+ ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s",user->nick,parameters[0].c_str(),
ServerInstance->TimeString(c_requires_crap).c_str());
}
ServerInstance->XLines->ApplyLines();
@@ -54,18 +54,18 @@ CmdResult CommandQline::Handle (const char* const* parameters, int pcnt, User *u
else
{
delete ql;
- user->WriteServ("NOTICE %s :*** Q-Line for %s already exists",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** Q-Line for %s already exists",user->nick,parameters[0].c_str());
}
}
else
{
- if (ServerInstance->XLines->DelLine(parameters[0],"Q",user))
+ if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "Q", user))
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Q-line on %s.",user->nick,parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Q-line on %s.",user->nick,parameters[0].c_str());
}
else
{
- user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0].c_str());
return CMD_FAILURE;
}
}
diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp
index f7cbd00bf..9de1faa04 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* const* parameters, int pcnt, User *user)
+CmdResult CommandQuit::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string quitmsg;
@@ -31,12 +31,12 @@ CmdResult CommandQuit::Handle (const char* const* parameters, int pcnt, User *us
if (*ServerInstance->Config->FixedQuit)
quitmsg = ServerInstance->Config->FixedQuit;
else
- quitmsg = pcnt ?
+ quitmsg = parameters.size() ?
ServerInstance->Config->PrefixQuit + std::string(parameters[0]) + ServerInstance->Config->SuffixQuit
: "Client exited";
}
else
- quitmsg = pcnt ? parameters[0] : "Client exited";
+ quitmsg = parameters.size() ? parameters[0] : "Client exited";
ServerInstance->Users->QuitUser(user, quitmsg);
diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp
index 0f60f4a6d..ce34239a5 100644
--- a/src/commands/cmd_rehash.cpp
+++ b/src/commands/cmd_rehash.cpp
@@ -22,23 +22,20 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandRehash(Instance);
}
-CmdResult CommandRehash::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string old_disabled = ServerInstance->Config->DisabledCommands;
- ServerInstance->Logs->Log("fuckingrehash", DEBUG, "parc %d p0 %s", pcnt, parameters[0]);
- if (pcnt && parameters[0][0] != '-')
+ if (parameters.size() && parameters[0][0] != '-')
{
if (!ServerInstance->MatchText(ServerInstance->Config->ServerName, parameters[0]))
{
- ServerInstance->Logs->Log("fuckingrehash", DEBUG, "rehash for a server, and not for us");
FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
return CMD_SUCCESS; // rehash for a server, and not for us
}
}
- else if (pcnt)
+ else if (parameters.size())
{
- ServerInstance->Logs->Log("fuckingrehash", DEBUG, "rehash for a subsystem, ignoring");
FOREACH_MOD(I_OnRehash,OnRehash(user, parameters[0]));
return CMD_SUCCESS;
}
@@ -65,7 +62,7 @@ CmdResult CommandRehash::Handle (const char* const* parameters, int pcnt, User *
if (!ServerInstance->ConfigThread)
{
ServerInstance->Config->RehashUser = user;
- ServerInstance->Config->RehashParameter = pcnt ? parameters[0] : "";
+ ServerInstance->Config->RehashParameter = parameters.size() ? parameters[0] : "";
ServerInstance->ConfigThread = new ConfigReaderThread(ServerInstance, false, user);
ServerInstance->Threads->Create(ServerInstance->ConfigThread);
diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp
index fcdc4cb1e..05162e631 100644
--- a/src/commands/cmd_reloadmodule.cpp
+++ b/src/commands/cmd_reloadmodule.cpp
@@ -19,20 +19,20 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandReloadmodule(Instance);
}
-CmdResult CommandReloadmodule::Handle (const char* const* parameters, int, User *user)
+CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (ServerInstance->Modules->Unload(parameters[0]))
+ if (ServerInstance->Modules->Unload(parameters[0].c_str()))
{
- ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unloaded %s",user->nick, parameters[0]);
- if (ServerInstance->Modules->Load(parameters[0]))
+ ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unloaded %s",user->nick, parameters[0].c_str());
+ if (ServerInstance->Modules->Load(parameters[0].c_str()))
{
- ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s reloaded %s",user->nick, parameters[0]);
- user->WriteNumeric(975, "%s %s :Module successfully reloaded.",user->nick, parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s reloaded %s",user->nick, parameters[0].c_str());
+ user->WriteNumeric(975, "%s %s :Module successfully reloaded.",user->nick, parameters[0].c_str());
return CMD_SUCCESS;
}
}
- ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unsuccessfully reloaded %s",user->nick, parameters[0]);
- user->WriteNumeric(975, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str());
+ ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unsuccessfully reloaded %s",user->nick, parameters[0].c_str());
+ user->WriteNumeric(975, "%s %s :%s",user->nick, parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp
index cc634d860..334fb621f 100644
--- a/src/commands/cmd_restart.cpp
+++ b/src/commands/cmd_restart.cpp
@@ -19,10 +19,10 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandRestart(Instance);
}
-CmdResult CommandRestart::Handle (const char* const* parameters, int, User *user)
+CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, User *user)
{
ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick);
- if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0], ServerInstance->Config->powerhash))
+ if (!ServerInstance->PassCompare(user, ServerInstance->Config->restartpass, parameters[0].c_str(), ServerInstance->Config->powerhash))
{
ServerInstance->SNO->WriteToSnoMask('A', "RESTART command from %s!%s@%s, restarting server.",user->nick,user->ident,user->host);
diff --git a/src/commands/cmd_rules.cpp b/src/commands/cmd_rules.cpp
index 685d04389..fd03e1d4c 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* const* parameters, int pcnt, User *user)
+CmdResult CommandRules::Handle (const std::vector<std::string>& parameters, User *user)
{
user->ShowRULES();
return CMD_SUCCESS;
diff --git a/src/commands/cmd_server.cpp b/src/commands/cmd_server.cpp
index f82263cca..5385428b8 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* const*, int, User *user)
+CmdResult CommandServer::Handle (const std::vector<std::string>&, User *user)
{
user->WriteNumeric(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 e98790380..61d0a601d 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* const*, int, User *user)
+CmdResult CommandSquit::Handle (const std::vector<std::string>&, 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 fb1aaf20b..174094afa 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -31,12 +31,12 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandStats(Instance);
}
-CmdResult CommandStats::Handle (const char* const* parameters, int /* pcnt */, User *user)
+CmdResult CommandStats::Handle (const std::vector<std::string>& parameters, User *user)
{
if (IS_LOCAL(user))
{
string_list values;
- DoStats(this->ServerInstance, *parameters[0], user, values);
+ DoStats(this->ServerInstance, parameters[0][0], user, values);
for (size_t i = 0; i < values.size(); i++)
user->Write(":%s", values[i].c_str());
}
diff --git a/src/commands/cmd_time.cpp b/src/commands/cmd_time.cpp
index c84b02122..d8c3561b0 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* const*, int, User *user)
+CmdResult CommandTime::Handle (const std::vector<std::string>&, 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 35d83c140..9f9d56b14 100644
--- a/src/commands/cmd_topic.cpp
+++ b/src/commands/cmd_topic.cpp
@@ -20,11 +20,11 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandTopic(Instance);
}
-CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User *user)
{
Channel* Ptr;
- if (pcnt == 1)
+ if (parameters.size() == 1)
{
Ptr = ServerInstance->FindChan(parameters[0]);
if (Ptr)
@@ -46,12 +46,12 @@ CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *u
}
else
{
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
return CMD_SUCCESS;
}
- else if (pcnt>1)
+ else if (parameters.size()>1)
{
Ptr = ServerInstance->FindChan(parameters[0]);
if (Ptr)
@@ -79,17 +79,17 @@ CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *u
*/
int MOD_RESULT = 0;
- strlcpy(topic,parameters[1],MAXTOPIC-1);
+ strlcpy(topic, parameters[1].c_str(), MAXTOPIC-1);
FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic));
if (MOD_RESULT)
return CMD_FAILURE;
- strlcpy(Ptr->topic,topic,MAXTOPIC-1);
+ strlcpy(Ptr->topic, topic, MAXTOPIC-1);
}
else
{
/* Sneaky shortcut, one string copy for a remote topic */
- strlcpy(Ptr->topic, parameters[1], MAXTOPIC-1);
+ strlcpy(Ptr->topic, parameters[1].c_str(), MAXTOPIC-1);
}
if (ServerInstance->Config->FullHostInTopic)
@@ -106,7 +106,7 @@ CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *u
}
else
{
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]);
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
}
diff --git a/src/commands/cmd_trace.cpp b/src/commands/cmd_trace.cpp
index 972080b70..9aa4eff53 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* const*, int, User *user)
+CmdResult CommandTrace::Handle (const std::vector<std::string>&, 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 f2e798f54..68ad591ce 100644
--- a/src/commands/cmd_unloadmodule.cpp
+++ b/src/commands/cmd_unloadmodule.cpp
@@ -21,16 +21,16 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandUnloadmodule(Instance);
}
-CmdResult CommandUnloadmodule::Handle (const char* const* parameters, int, User *user)
+CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
{
- if (ServerInstance->Modules->Unload(parameters[0]))
+ if (ServerInstance->Modules->Unload(parameters[0].c_str()))
{
- ServerInstance->SNO->WriteToSnoMask('A', "MODULE UNLOADED: %s unloaded %s", user->nick, parameters[0]);
- user->WriteNumeric(973, "%s %s :Module successfully unloaded.",user->nick, parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('A', "MODULE UNLOADED: %s unloaded %s", user->nick, parameters[0].c_str());
+ user->WriteNumeric(973, "%s %s :Module successfully unloaded.",user->nick, parameters[0].c_str());
}
else
{
- user->WriteNumeric(972, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str());
+ user->WriteNumeric(972, "%s %s :%s",user->nick, parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp
index 3ee96b2f9..46d42771b 100644
--- a/src/commands/cmd_user.cpp
+++ b/src/commands/cmd_user.cpp
@@ -19,12 +19,12 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandUser(Instance);
}
-CmdResult CommandUser::Handle (const char* const* parameters, int, User *user)
+CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User *user)
{
/* A user may only send the USER command once */
if (!(user->registered & REG_USER))
{
- if (!ServerInstance->IsIdent(parameters[0]))
+ if (!ServerInstance->IsIdent(parameters[0].c_str()))
{
/*
* RFC says we must use this numeric, so we do. Let's make it a little more nub friendly though. :)
@@ -40,8 +40,8 @@ CmdResult CommandUser::Handle (const char* const* parameters, int, User *user)
* ~ character, and +1 for null termination, therefore we can safely use up to
* IDENTMAX here.
*/
- strlcpy(user->ident, parameters[0], IDENTMAX);
- strlcpy(user->fullname, *parameters[3] ? parameters[3] : "No info", MAXGECOS);
+ strlcpy(user->ident, parameters[0].c_str(), IDENTMAX);
+ strlcpy(user->fullname, !parameters[3].empty() ? parameters[3].c_str() : "No info", MAXGECOS);
user->registered = (user->registered | REG_USER);
}
}
diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp
index c8a33535f..9ed8b30ab 100644
--- a/src/commands/cmd_userhost.cpp
+++ b/src/commands/cmd_userhost.cpp
@@ -19,12 +19,12 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandUserhost(Instance);
}
-CmdResult CommandUserhost::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string retbuf = std::string("302 ") + user->nick + " :";
- for (int i = 0; i < pcnt; i++)
+ for (unsigned int i = 0; i < parameters.size(); i++)
{
User *u = ServerInstance->FindNick(parameters[i]);
diff --git a/src/commands/cmd_version.cpp b/src/commands/cmd_version.cpp
index 5c87ca8e4..1951417d7 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* const*, int, User *user)
+CmdResult CommandVersion::Handle (const std::vector<std::string>&, User *user)
{
user->WriteNumeric(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 cd8995ad8..849457b23 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* const* parameters, int, User *user)
+CmdResult CommandWallops::Handle (const std::vector<std::string>& parameters, 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 2758f6b85..51590f143 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* const* parameters, int pcnt, User *user)
+CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *user)
{
/*
* XXX - RFC says:
@@ -191,13 +191,14 @@ CmdResult CommandWho::Handle (const char* const* parameters, int pcnt, User *use
std::vector<std::string> whoresults;
std::string initial = "352 " + std::string(user->nick) + " ";
- const char* matchtext = NULL;
+ char matchtext[MAXBUF];
bool usingwildcards = false;
/* Change '0' into '*' so the wildcard matcher can grok it */
- matchtext = parameters[0];
- if (!strcmp(matchtext,"0"))
- matchtext = "*";
+ if (parameters[0] == "0")
+ strlcpy(matchtext, "*", MAXBUF);
+ else
+ strlcpy(matchtext, parameters[0].c_str(), MAXBUF);
for (const char* check = matchtext; *check; check++)
{
@@ -208,10 +209,10 @@ CmdResult CommandWho::Handle (const char* const* parameters, int pcnt, User *use
}
}
- if (pcnt > 1)
+ if (parameters.size() > 1)
{
/* parse flags */
- const char *iter = parameters[1];
+ const char *iter = parameters[1].c_str();
/* Fix for bug #444, WHO flags count as a wildcard */
usingwildcards = true;
@@ -336,13 +337,13 @@ CmdResult CommandWho::Handle (const char* const* parameters, int pcnt, User *use
{
for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
user->WriteServ(*n);
- user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick, *parameters[0] ? parameters[0] : "*");
+ user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick, *parameters[0].c_str() ? parameters[0].c_str() : "*");
return CMD_SUCCESS;
}
else
{
/* BZZT! Too many results. */
- user->WriteNumeric(315, "%s %s :Too many results",user->nick, parameters[0]);
+ user->WriteNumeric(315, "%s %s :Too many results",user->nick, parameters[0].c_str());
return CMD_FAILURE;
}
}
diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp
index a10f170f1..263377b8f 100644
--- a/src/commands/cmd_whois.cpp
+++ b/src/commands/cmd_whois.cpp
@@ -103,13 +103,13 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandWhois(Instance);
}
-CmdResult CommandWhois::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandWhois::Handle (const std::vector<std::string>& parameters, User *user)
{
User *dest;
int userindex = 0;
unsigned long idle = 0, signon = 0;
- if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, parameters.size(), 0))
return CMD_SUCCESS;
@@ -117,7 +117,7 @@ CmdResult CommandWhois::Handle (const char* const* parameters, int pcnt, User *u
* If 2 paramters are specified (/whois nick nick), ignore the first one like spanningtree
* does, and use the second one, otherwise, use the only paramter. -- djGrrr
*/
- if (pcnt > 1)
+ if (parameters.size() > 1)
userindex = 1;
if (IS_LOCAL(user))
@@ -130,24 +130,24 @@ CmdResult CommandWhois::Handle (const char* const* parameters, int pcnt, User *u
/*
* Okay. Umpteenth attempt at doing this, so let's re-comment...
* For local users (/w localuser), we show idletime if hidewhois is disabled
- * For local users (/w localuser localuser), we always show idletime, hence pcnt > 1 check.
+ * For local users (/w localuser localuser), we always show idletime, hence parameters.size() > 1 check.
* For remote users (/w remoteuser), we do NOT show idletime
* For remote users (/w remoteuser remoteuser), spanningtree will handle calling do_whois, so we can ignore this case.
* Thanks to djGrrr for not being impatient while I have a crap day coding. :p -- w00t
*/
- if (IS_LOCAL(dest) && (!*ServerInstance->Config->HideWhoisServer || pcnt > 1))
+ if (IS_LOCAL(dest) && (!*ServerInstance->Config->HideWhoisServer || parameters.size() > 1))
{
idle = abs((dest->idle_lastmsg)-ServerInstance->Time());
signon = dest->signon;
}
- do_whois(this->ServerInstance, user,dest,signon,idle,parameters[userindex]);
+ do_whois(this->ServerInstance, user,dest,signon,idle,parameters[userindex].c_str());
}
else
{
/* no such nick/channel */
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, *parameters[userindex] ? parameters[userindex] : "*");
- user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick, *parameters[userindex] ? parameters[userindex] : "*");
+ user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, !parameters[userindex].empty() ? parameters[userindex].c_str() : "*");
+ user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick, parameters[userindex].empty() ? parameters[userindex].c_str() : "*");
return CMD_FAILURE;
}
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp
index 485106e27..8bc188eee 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* const* parameters, int, User* user)
+CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, User* user)
{
/* if whowas disabled in config */
if (ServerInstance->Config->WhoWasGroupSize == 0 || ServerInstance->Config->WhoWasMaxGroups == 0)
@@ -37,12 +37,12 @@ CmdResult CommandWhowas::Handle (const char* const* parameters, int, User* user)
return CMD_FAILURE;
}
- whowas_users::iterator i = whowas.find(parameters[0]);
+ whowas_users::iterator i = whowas.find(assign(parameters[0]));
if (i == whowas.end())
{
- user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick,parameters[0]);
- user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0]);
+ user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick,parameters[0].c_str());
+ user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0].c_str());
return CMD_FAILURE;
}
else
@@ -63,26 +63,26 @@ CmdResult CommandWhowas::Handle (const char* const* parameters, int, User* user)
strlcpy(b,asctime(timeinfo),MAXBUF);
b[24] = 0;
- user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos);
+ user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick,parameters[0].c_str(),u->ident,u->dhost,u->gecos);
if (IS_OPER(user))
- user->WriteNumeric(379, "%s %s :was connecting from *@%s", user->nick, parameters[0], u->host);
+ user->WriteNumeric(379, "%s %s :was connecting from *@%s", user->nick, parameters[0].c_str(), u->host);
if (*ServerInstance->Config->HideWhoisServer && !IS_OPER(user))
- user->WriteNumeric(312, "%s %s %s :%s",user->nick,parameters[0], ServerInstance->Config->HideWhoisServer, b);
+ user->WriteNumeric(312, "%s %s %s :%s",user->nick,parameters[0].c_str(), ServerInstance->Config->HideWhoisServer, b);
else
- user->WriteNumeric(312, "%s %s %s :%s",user->nick,parameters[0], u->server, b);
+ user->WriteNumeric(312, "%s %s %s :%s",user->nick,parameters[0].c_str(), u->server, b);
}
}
else
{
- user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick,parameters[0]);
- user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0]);
+ user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick,parameters[0].c_str());
+ user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0].c_str());
return CMD_FAILURE;
}
}
- user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0]);
+ user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0].c_str());
return CMD_SUCCESS;
}
diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp
index c4bc750c7..c1951d447 100644
--- a/src/commands/cmd_zline.cpp
+++ b/src/commands/cmd_zline.cpp
@@ -22,15 +22,15 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance)
return new CommandZline(Instance);
}
-CmdResult CommandZline::Handle (const char* const* parameters, int pcnt, User *user)
+CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User *user)
{
std::string target = parameters[0];
- if (pcnt >= 3)
+ if (parameters.size() >= 3)
{
- if (strchr(target.c_str(),'@') || strchr(target.c_str(),'!'))
+ if (target.find('!') != std::string::npos)
{
- user->WriteServ("NOTICE %s :*** You cannot include a username or nickname in a zline, a zline must ban only an IP mask",user->nick);
+ user->WriteServ("NOTICE %s :*** You cannot include a nickname in a zline, a zline must ban only an IP mask",user->nick);
return CMD_FAILURE;
}
@@ -44,7 +44,7 @@ CmdResult CommandZline::Handle (const char* const* parameters, int pcnt, User *u
if (ServerInstance->IPMatchesEveryone(target.c_str(),user))
return CMD_FAILURE;
- long duration = ServerInstance->Duration(parameters[1]);
+ long duration = ServerInstance->Duration(parameters[1].c_str());
const char* ipaddr = target.c_str();
User* find = ServerInstance->FindNick(target.c_str());
@@ -62,7 +62,7 @@ CmdResult CommandZline::Handle (const char* const* parameters, int pcnt, User *u
ipaddr++;
}
}
- ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ipaddr);
+ ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), ipaddr);
if (ServerInstance->XLines->AddLine(zl,user))
{
if (!duration)