summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authoraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-05 02:06:59 +0000
committeraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-05-05 02:06:59 +0000
commitb817341e2149af163011cce47605ae17b4f67eeb (patch)
treea347cf649563bf5f1f5de40f7514a5ded48c7c32 /src/modules
parentdfaa7b4e52e2cfbff79ab9ecad9904a07512b370 (diff)
Conversions
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9628 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_rline.cpp18
-rw-r--r--src/modules/m_messageflood.cpp10
-rw-r--r--src/modules/m_nicklock.cpp8
-rw-r--r--src/modules/m_opermodes.cpp6
-rw-r--r--src/modules/m_opermotd.cpp2
-rw-r--r--src/modules/m_password_hash.cpp4
-rw-r--r--src/modules/m_randquote.cpp4
-rw-r--r--src/modules/m_remove.cpp18
-rw-r--r--src/modules/m_sajoin.cpp6
-rw-r--r--src/modules/m_samode.cpp4
-rw-r--r--src/modules/m_sanick.cpp10
-rw-r--r--src/modules/m_sapart.cpp8
-rw-r--r--src/modules/m_saquit.cpp6
-rw-r--r--src/modules/m_sasl.cpp11
-rw-r--r--src/modules/m_services.cpp5
-rw-r--r--src/modules/m_sethost.cpp8
-rw-r--r--src/modules/m_setident.cpp10
-rw-r--r--src/modules/m_setidle.cpp2
-rw-r--r--src/modules/m_setname.cpp10
-rw-r--r--src/modules/m_shun.cpp22
-rw-r--r--src/modules/m_silence.cpp18
-rw-r--r--src/modules/m_spanningtree/rconnect.cpp5
22 files changed, 98 insertions, 97 deletions
diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp
index 1a030d38a..1503f04d9 100644
--- a/src/modules/extra/m_rline.cpp
+++ b/src/modules/extra/m_rline.cpp
@@ -131,10 +131,10 @@ class CommandRLine : public Command
this->source = "m_rline.so";
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- if (pcnt >= 3)
+ if (parameters.size() >= 3)
{
// Adding - XXX todo make this respect <insane> tag perhaps..
@@ -143,7 +143,7 @@ class CommandRLine : public Command
try
{
- r = new RLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]);
+ r = new RLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), parameters[0].c_str());
}
catch (...)
{
@@ -156,12 +156,12 @@ class CommandRLine : public Command
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent R-Line for %s.", user->nick, parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent R-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 R-Line for %s, expires on %s", user->nick, parameters[0],
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-Line for %s, expires on %s", user->nick, parameters[0].c_str(),
ServerInstance->TimeString(c_requires_crap).c_str());
}
@@ -170,20 +170,20 @@ class CommandRLine : public Command
else
{
delete r;
- user->WriteServ("NOTICE %s :*** R-Line for %s already exists", user->nick, parameters[0]);
+ user->WriteServ("NOTICE %s :*** R-Line for %s already exists", user->nick, parameters[0].c_str());
}
}
}
else
{
- if (ServerInstance->XLines->DelLine(parameters[0], "R", user))
+ if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "R", user))
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s Removed R-Line on %s.",user->nick,parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('x',"%s Removed R-Line on %s.",user->nick,parameters[0].c_str());
}
else
{
// XXX todo implement stats
- user->WriteServ("NOTICE %s :*** R-Line %s not found in list, try /stats g.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** R-Line %s not found in list, try /stats g.",user->nick,parameters[0].c_str());
}
}
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp
index c2a0b32ec..25350b15b 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -232,11 +232,11 @@ class ModuleMsgFlood : public Module
f->clear(user);
if (f->ban)
{
- const char* parameters[3];
- parameters[0] = dest->name;
- parameters[1] = "+b";
- parameters[2] = user->MakeWildHost();
- ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient);
+ std::vector<std::string> parameters(3);
+ parameters.push_back(dest->name);
+ parameters.push_back("+b");
+ parameters.push_back(user->MakeWildHost());
+ ServerInstance->SendMode(parameters, ServerInstance->FakeClient);
ServerInstance->PI->SendModeStr(dest->name, std::string("+b ") + user->MakeWildHost());
}
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index cd4a1f8ba..7f64cba59 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -28,7 +28,7 @@ class CommandNicklock : public Command
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
- CmdResult Handle(const std::vector<const std::string>& parameters, User *user)
+ CmdResult Handle(const std::vector<std::string>& parameters, User *user)
{
User* target = ServerInstance->FindNick(parameters[0]);
irc::string server;
@@ -48,7 +48,7 @@ class CommandNicklock : public Command
}
// check nick is valid
- if (!ServerInstance->IsNick(parameters[1]))
+ if (!ServerInstance->IsNick(parameters[1].c_str()))
{
return CMD_FAILURE;
}
@@ -56,7 +56,7 @@ class CommandNicklock : public Command
// let others know
ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used NICKLOCK to change and hold "+parameters[0]+" to "+parameters[1]);
- if (!target->ForceNickChange(parameters[1]))
+ if (!target->ForceNickChange(parameters[1].c_str()))
{
// ugh, nickchange failed for some reason -- possibly existing nick? XXX change to UID here
ServerInstance->Users->QuitUser(target, "Nickname collision");
@@ -81,7 +81,7 @@ class CommandNickunlock : public Command
syntax = "<locked-nick>";
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
User* target = ServerInstance->FindNick(parameters[0]);
if (target)
diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp
index 877b9b441..8a91c3569 100644
--- a/src/modules/m_opermodes.cpp
+++ b/src/modules/m_opermodes.cpp
@@ -100,7 +100,8 @@ class ModuleModesOnOper : public Module
tokens.push_back(buf);
int size = tokens.size() + 1;
- const char** modes = new const char*[size];
+ std::vector<std::string> modes(size);
+ modes.resize(size);
modes[0] = u->nick;
// process mode params
@@ -116,8 +117,7 @@ class ModuleModesOnOper : public Module
n.push_back(modes[j]);
ServerInstance->PI->SendMode(u->uuid, n);
- ServerInstance->SendMode(modes, size, u);
- delete [] modes;
+ ServerInstance->SendMode(modes, u);
}
};
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index 9cf068959..d834a6029 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -49,7 +49,7 @@ class CommandOpermotd : public Command
syntax = "[<servername>]";
}
- CmdResult Handle (const std::vector<const std::string>& parameters, User* user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User* user)
{
return ShowOperMOTD(user);
}
diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp
index 68ed39c4d..bc0a14f86 100644
--- a/src/modules/m_password_hash.cpp
+++ b/src/modules/m_password_hash.cpp
@@ -52,9 +52,9 @@ class CommandMkpasswd : public Command
}
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- MakeHash(user, parameters[0], parameters[1]);
+ MakeHash(user, parameters[0].c_str(), parameters[1].c_str());
/* NOTE: Don't propagate this across the network!
* We dont want plaintext passes going all over the place...
* To make sure it goes nowhere, return CMD_FAILURE!
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index 0353ae939..38c11ff95 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -31,7 +31,7 @@ class CommandRandquote : public Command
this->source = "m_randquote.so";
}
- CmdResult Handle (const char* const* parameters, int pcntl, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
std::string str;
int fsize;
@@ -107,7 +107,7 @@ class ModuleRandQuote : public Module
virtual void OnUserConnect(User* user)
{
if (mycommand)
- mycommand->Handle(NULL, 0, user);
+ mycommand->Handle(std::vector<std::string>(), user);
}
};
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index b87b5d2c1..008b4c82d 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -69,7 +69,7 @@ class RemoveBase
}
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user, bool neworder)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user, bool neworder)
{
const char* channame;
const char* username;
@@ -87,8 +87,8 @@ class RemoveBase
* /remove <nick> <channel> [reason ...]
* /fpart <channel> <nick> [reason ...]
*/
- channame = parameters[ neworder ? 0 : 1];
- username = parameters[ neworder ? 1 : 0];
+ channame = parameters[ neworder ? 0 : 1].c_str();
+ username = parameters[ neworder ? 1 : 0].c_str();
/* Look up the user we're meant to be removing from the channel */
target = ServerInstance->FindNick(username);
@@ -167,10 +167,10 @@ class RemoveBase
std::string reasonparam("No reason given");
/* If a reason is given, use it */
- if(pcnt > 2)
+ if(parameters.size() > 2)
{
/* Join params 2 ... pcnt - 1 (inclusive) into one */
- irc::stringjoiner reason_join(" ", parameters, 2, pcnt - 1);
+ irc::stringjoiner reason_join(" ", parameters, 2, parameters.size() - 1);
reasonparam = reason_join.GetJoined();
}
@@ -213,9 +213,9 @@ class CommandRemove : public Command, public RemoveBase
TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- return RemoveBase::Handle(parameters, pcnt, user, false);
+ return RemoveBase::Handle(parameters, user, false);
}
};
@@ -230,9 +230,9 @@ class CommandFpart : public Command, public RemoveBase
syntax = "<channel> <nick> [<reason>]";
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- return RemoveBase::Handle(parameters, pcnt, user, true);
+ return RemoveBase::Handle(parameters, user, true);
}
};
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 18143043b..da81712c6 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -27,7 +27,7 @@ class CommandSajoin : public Command
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
User* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
@@ -37,7 +37,7 @@ class CommandSajoin : public Command
user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick);
return CMD_FAILURE;
}
- if (!ServerInstance->IsChannel(parameters[1]))
+ if (!ServerInstance->IsChannel(parameters[1].c_str()))
{
/* we didn't need to check this for each character ;) */
user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
@@ -50,7 +50,7 @@ class CommandSajoin : public Command
*/
if (IS_LOCAL(dest))
{
- Channel::JoinUser(ServerInstance, dest, parameters[1], true, "", false, ServerInstance->Time());
+ Channel::JoinUser(ServerInstance, dest, parameters[1].c_str(), true, "", false, ServerInstance->Time());
/* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propagate */
Channel* n = ServerInstance->FindChan(parameters[1]);
if (n)
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 3dcd48ca5..6cf7a5fbc 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -26,12 +26,12 @@ class CommandSamode : public Command
syntax = "<target> <modes> {<mode-parameters>}";
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
/*
* Handles an SAMODE request. Notifies all +s users.
*/
- ServerInstance->SendMode(parameters, pcnt, ServerInstance->FakeClient);
+ ServerInstance->SendMode(parameters, ServerInstance->FakeClient);
if (ServerInstance->Modes->GetLastParse().length())
{
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index ae9e6b2d8..d63155b49 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -27,7 +27,7 @@ class CommandSanick : public Command
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
User* target = ServerInstance->FindNick(parameters[0]);
if (target)
@@ -38,9 +38,9 @@ class CommandSanick : public Command
return CMD_FAILURE;
}
std::string oldnick = user->nick;
- if (ServerInstance->IsNick(parameters[1]))
+ if (ServerInstance->IsNick(parameters[1].c_str()))
{
- if (target->ForceNickChange(parameters[1]))
+ if (target->ForceNickChange(parameters[1].c_str()))
{
ServerInstance->SNO->WriteToSnoMask('A', oldnick+" used SANICK to change "+std::string(parameters[0])+" to "+parameters[1]);
return CMD_SUCCESS;
@@ -54,14 +54,14 @@ class CommandSanick : public Command
}
else
{
- user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick, parameters[1]);
+ user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick, parameters[1].c_str());
}
return CMD_FAILURE;
}
else
{
- user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick, parameters[0]);
+ user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick, parameters[0].c_str());
}
return CMD_FAILURE;
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index 999676f19..7f5135970 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -27,7 +27,7 @@ class CommandSapart : public Command
TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
User* dest = ServerInstance->FindNick(parameters[0]);
Channel* channel = ServerInstance->FindChan(parameters[1]);
@@ -35,8 +35,8 @@ class CommandSapart : public Command
if (dest && channel)
{
- ServerInstance->Logs->Log("m_sapart",DEBUG, "SAPART: pcnt is %d", pcnt);
- if (pcnt == 3)
+ ServerInstance->Logs->Log("m_sapart",DEBUG, "SAPART: pcnt is %d", parameters.size());
+ if (parameters.size() == 3)
reason = parameters[2];
else
reason = dest->nick;
@@ -70,7 +70,7 @@ class CommandSapart : public Command
}
else
{
- user->WriteServ("NOTICE %s :*** Unable to make %s part %s",user->nick, dest->nick, parameters[1]);
+ user->WriteServ("NOTICE %s :*** Unable to make %s part %s",user->nick, dest->nick, parameters[1].c_str());
return CMD_FAILURE;
}
}
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index 17ccd713d..485d03260 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -27,7 +27,7 @@ class CommandSaquit : public Command
TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
User* dest = ServerInstance->FindNick(parameters[0]);
if (dest)
@@ -38,7 +38,7 @@ class CommandSaquit : public Command
return CMD_FAILURE;
}
- irc::stringjoiner reason_join(" ", parameters, 1, pcnt - 1);
+ irc::stringjoiner reason_join(" ", parameters, 1, parameters.size() - 1);
std::string line = reason_join.GetJoined();
ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+line);
@@ -51,7 +51,7 @@ class CommandSaquit : public Command
}
else
{
- user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick, parameters[0]);
+ user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick, parameters[0].c_str());
}
return CMD_FAILURE;
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 259c3bd16..ffd6259ff 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -101,7 +101,7 @@ class SaslAuthenticator : public classbase
this->result = SASL_ABORT;
}
- bool SendClientMessage(const char* const* parameters, int pcnt)
+ bool SendClientMessage(const std::vector<std::string>& parameters)
{
if (this->state != SASL_COMM)
return true;
@@ -113,12 +113,11 @@ class SaslAuthenticator : public classbase
params.push_back(this->agent);
params.push_back("C");
- for (int i = 0; i < pcnt; ++i)
- params.push_back(parameters[i]);
+ params.insert(params.end(), parameters.begin(), parameters.end());
ServerInstance->PI->SendEncapsulatedData(params);
- if (*parameters[0] == '*')
+ if (parameters[0][0] == '*')
{
this->Abort();
return false;
@@ -166,7 +165,7 @@ class CommandAuthenticate : public Command
this->source = "m_sasl.so";
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
/* Only allow AUTHENTICATE on unregistered clients */
if (user->registered != REG_ALL)
@@ -177,7 +176,7 @@ class CommandAuthenticate : public Command
SaslAuthenticator *sasl;
if (!(user->GetExt("sasl_authenticator", sasl)))
sasl = new SaslAuthenticator(user, parameters[0], ServerInstance, Creator);
- else if (sasl->SendClientMessage(parameters, pcnt) == false) // IAL abort extension --nenolod
+ else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod
delete sasl;
}
return CMD_FAILURE;
diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp
index 669a87aeb..bcac36b60 100644
--- a/src/modules/m_services.cpp
+++ b/src/modules/m_services.cpp
@@ -140,11 +140,12 @@ class ModuleServices : public Module
/* On nickchange, if they have +r, remove it */
if (user->IsModeSet('r') && irc::string(user->nick) != oldnick)
{
- const char* modechange[2];
+ std::vector<std::string> modechange;
+ modechange.resize(2);
modechange[0] = user->nick;
modechange[1] = "-r";
kludgeme = true;
- ServerInstance->SendMode(modechange,2,user);
+ ServerInstance->SendMode(modechange,user);
kludgeme = false;
}
}
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index 981efbbd8..cdcbbde9e 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -29,12 +29,12 @@ class CommandSethost : public Command
TRANSLATE2(TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
size_t len = 0;
- for (const char* x = parameters[0]; *x; x++, len++)
+ for (std::string::const_iterator x = parameters[0].begin(); x != parameters[0].end(); x++, len++)
{
- if (!hostmap[(unsigned char)*x])
+ if (!hostmap[(const unsigned char)*x])
{
user->WriteServ("NOTICE "+std::string(user->nick)+" :*** SETHOST: Invalid characters in hostname");
return CMD_FAILURE;
@@ -50,7 +50,7 @@ class CommandSethost : public Command
user->WriteServ("NOTICE %s :*** SETHOST: Host too long",user->nick);
return CMD_FAILURE;
}
- if (user->ChangeDisplayedHost(parameters[0]))
+ if (user->ChangeDisplayedHost(parameters[0].c_str()))
{
ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used SETHOST to change their displayed host to "+user->dhost);
return CMD_SUCCESS;
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index 5abdcb433..0456a8539 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -27,27 +27,27 @@ class CommandSetident : public Command
TRANSLATE2(TR_TEXT, TR_END);
}
- CmdResult Handle(const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle(const std::vector<std::string>& parameters, User *user)
{
- if (!*parameters[0])
+ if (parameters.size() == 0)
{
user->WriteServ("NOTICE %s :*** SETIDENT: Ident must be specified", user->nick);
return CMD_FAILURE;
}
- if (strlen(parameters[0]) > IDENTMAX)
+ if (parameters[0].size() > IDENTMAX)
{
user->WriteServ("NOTICE %s :*** SETIDENT: Ident is too long", user->nick);
return CMD_FAILURE;
}
- if (!ServerInstance->IsIdent(parameters[0]))
+ if (!ServerInstance->IsIdent(parameters[0].c_str()))
{
user->WriteServ("NOTICE %s :*** SETIDENT: Invalid characters in ident", user->nick);
return CMD_FAILURE;
}
- user->ChangeIdent(parameters[0]);
+ user->ChangeIdent(parameters[0].c_str());
ServerInstance->SNO->WriteToSnoMask('A', "%s used SETIDENT to change their ident to '%s'", user->nick, user->ident);
return CMD_SUCCESS;
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index 306fd499c..ce191910a 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -27,7 +27,7 @@ class CommandSetidle : public Command
TRANSLATE2(TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
time_t idle = ServerInstance->Duration(parameters[0]);
if (idle < 1)
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index 8c48be9a5..75156378d 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -27,23 +27,23 @@ class CommandSetname : public Command
TRANSLATE2(TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- if (!*parameters[0])
+ if (parameters.size() == 0)
{
user->WriteServ("NOTICE %s :*** SETNAME: GECOS must be specified", user->nick);
return CMD_FAILURE;
}
- if (strlen(parameters[0]) > MAXGECOS)
+ if (parameters[0].size() > MAXGECOS)
{
user->WriteServ("NOTICE %s :*** SETNAME: GECOS too long", user->nick);
return CMD_FAILURE;
}
- if (user->ChangeName(parameters[0]))
+ if (user->ChangeName(parameters[0].c_str()))
{
- ServerInstance->SNO->WriteToSnoMask('A', "%s used SETNAME to change their GECOS to %s", user->nick, parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('A', "%s used SETNAME to change their GECOS to %s", user->nick, parameters[0].c_str());
return CMD_SUCCESS;
}
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 95c7cd37b..d5ad01dc0 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -85,26 +85,26 @@ class cmd_shun : public Command
this->source = "m_shun.so";
}
- CmdResult Handle(const char* const*parameters, int pcnt, User *user)
+ CmdResult Handle(const std::vector<std::string>& parameters, User *user)
{
/* syntax: SHUN nick!user@host time :reason goes here */
/* 'time' is a human-readable timestring, like 2d3h2s. */
- if(pcnt == 1)
+ if (parameters.size() == 1)
{
- if (ServerInstance->XLines->DelLine(parameters[0], "SHUN", user))
+ if (ServerInstance->XLines->DelLine(parameters[0].c_str(), "SHUN", user))
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s Removed shun on %s.",user->nick,parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('x',"%s Removed shun on %s.",user->nick,parameters[0].c_str());
}
else
{
// XXX todo implement stats
- user->WriteServ("NOTICE %s :*** Shun %s not found in list, try /stats s.",user->nick,parameters[0]);
+ user->WriteServ("NOTICE %s :*** Shun %s not found in list, try /stats s.",user->nick,parameters[0].c_str());
}
return CMD_SUCCESS;
}
- else if (pcnt >= 2)
+ else if (parameters.size() >= 2)
{
// Adding - XXX todo make this respect <insane> tag perhaps..
long duration = ServerInstance->Duration(parameters[1]);
@@ -112,7 +112,7 @@ class cmd_shun : public Command
try
{
- r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], parameters[0]);
+ r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2].c_str(), parameters[0].c_str());
}
catch (...)
{
@@ -125,12 +125,12 @@ class cmd_shun : public Command
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent shun for %s.", user->nick, parameters[0]);
+ ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent shun for %s.", user->nick, parameters[0].c_str());
}
else
{
time_t c_requires_crap = duration + ServerInstance->Time();
- ServerInstance->SNO->WriteToSnoMask('x', "%s added timed shun for %s, expires on %s", user->nick, parameters[0],
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed shun for %s, expires on %s", user->nick, parameters[0].c_str(),
ServerInstance->TimeString(c_requires_crap).c_str());
}
@@ -139,7 +139,7 @@ class cmd_shun : public Command
else
{
delete r;
- user->WriteServ("NOTICE %s :*** Shun for %s already exists", user->nick, parameters[0]);
+ user->WriteServ("NOTICE %s :*** Shun for %s already exists", user->nick, parameters[0].c_str());
}
}
}
@@ -195,7 +195,7 @@ class ModuleShun : public Module
}
}
- virtual int OnPreCommand(const std::string &command, const char* const*parameters, int pcnt, User* user, bool validated, const std::string &original_line)
+ virtual int OnPreCommand(const std::string &command, const std::vector<std::string>& parameters, User* user, bool validated, const std::string &original_line)
{
if((command != "PONG") && (command != "PING"))
{
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index 2a8fbae94..7d1e80d62 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -61,7 +61,7 @@ class CommandSVSSilence : public Command
TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
/*
* XXX: thought occurs to me
@@ -79,7 +79,7 @@ class CommandSVSSilence : public Command
if (IS_LOCAL(u))
{
- ServerInstance->Parser->CallHandler("SILENCE", &parameters[1], 1, u);
+ ServerInstance->Parser->CallHandler("SILENCE", std::vector<std::string>(++parameters.begin(), parameters.end()), u);
}
return CMD_SUCCESS;
@@ -97,9 +97,9 @@ class CommandSilence : public Command
TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
}
- CmdResult Handle (const char* const* parameters, int pcnt, User *user)
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user)
{
- if (!pcnt)
+ if (!parameters.size())
{
// no parameters, show the current silence list.
// Use Extensible::GetExt to fetch the silence list
@@ -117,17 +117,17 @@ class CommandSilence : public Command
return CMD_LOCALONLY;
}
- else if (pcnt > 0)
+ else if (parameters.size() > 0)
{
// one or more parameters, add or delete entry from the list (only the first parameter is used)
- std::string mask = parameters[0] + 1;
- char action = *parameters[0];
+ std::string mask = parameters[0].substr(1);
+ char action = parameters[0][0];
// Default is private and notice so clients do not break
int pattern = CompilePattern("pn");
// if pattern supplied, use it
- if (pcnt > 1) {
- pattern = CompilePattern(parameters[1]);
+ if (parameters.size() > 1) {
+ pattern = CompilePattern(parameters[1].c_str());
}
if (!mask.length())
diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp
index 388f77ab7..1dce8e7e4 100644
--- a/src/modules/m_spanningtree/rconnect.cpp
+++ b/src/modules/m_spanningtree/rconnect.cpp
@@ -53,8 +53,9 @@ CmdResult cmd_rconnect::Handle (const std::vector<std::string>& parameters, User
{
/* Yes, initiate the given connect */
ServerInstance->SNO->WriteToSnoMask('l',"Remote CONNECT from %s matching \002%s\002, connecting server \002%s\002",user->nick,parameters[0].c_str(),parameters[1].c_str());
- std::vector<std::string> para(1);
- para.push_back(parameters[1]);
+ std::vector<std::string> para;
+ para.resize(1);
+ para[0] = parameters[1];
std::string original_command = std::string("CONNECT ") + parameters[1];
Creator->OnPreCommand("CONNECT", para, user, true, original_command);
}