summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-25 00:37:43 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-25 00:37:43 +0000
commitb2a57b09742da6c2f2011ad41eb470139d88e14f (patch)
tree054e41a724108706c5ea5f659d2065fe5fae2504
parent443654f15bf036bb18f9847332e2bd03ec823b3d (diff)
Changed params parameter of Command's Execute() from std::vector<std::string> to std::vector<ci::string>, seems to have no ill effects but may require some testing to be sure.
Also a few minor cleanups here and there. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2392 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--include/modules.h6
-rw-r--r--src/command.cpp2
-rw-r--r--src/commands.c8
-rw-r--r--src/core/bs_act.c5
-rw-r--r--src/core/bs_assign.c2
-rw-r--r--src/core/bs_badwords.c26
-rw-r--r--src/core/bs_bot.c16
-rw-r--r--src/core/bs_botlist.c2
-rw-r--r--src/core/bs_help.c8
-rw-r--r--src/core/bs_info.c2
-rw-r--r--src/core/bs_kick.c44
-rw-r--r--src/core/bs_say.c3
-rw-r--r--src/core/bs_set.c50
-rw-r--r--src/core/bs_unassign.c2
-rw-r--r--src/core/cs_access.c36
-rw-r--r--src/core/cs_akick.c29
-rw-r--r--src/core/cs_ban.c6
-rw-r--r--src/core/cs_clear.c20
-rw-r--r--src/core/cs_drop.c7
-rw-r--r--src/core/cs_forbid.c5
-rw-r--r--src/core/cs_getkey.c3
-rw-r--r--src/core/cs_getpass.c2
-rw-r--r--src/core/cs_help.c8
-rw-r--r--src/core/cs_identify.c3
-rw-r--r--src/core/cs_info.c12
-rw-r--r--src/core/cs_invite.c9
-rw-r--r--src/core/cs_kick.c3
-rw-r--r--src/core/cs_list.c14
-rw-r--r--src/core/cs_logout.c3
-rw-r--r--src/core/cs_modes.c31
-rw-r--r--src/core/cs_register.c3
-rw-r--r--src/core/cs_sendpass.c2
-rw-r--r--src/core/cs_set.c60
-rw-r--r--src/core/cs_status.c2
-rw-r--r--src/core/cs_suspend.c4
-rw-r--r--src/core/cs_topic.c2
-rw-r--r--src/core/cs_xop.c30
-rw-r--r--src/core/hs_del.c2
-rw-r--r--src/core/hs_delall.c2
-rw-r--r--src/core/hs_group.c2
-rw-r--r--src/core/hs_help.c4
-rw-r--r--src/core/hs_list.c2
-rw-r--r--src/core/hs_off.c2
-rw-r--r--src/core/hs_on.c2
-rw-r--r--src/core/hs_set.c2
-rw-r--r--src/core/hs_setall.c2
-rw-r--r--src/core/ms_cancel.c2
-rw-r--r--src/core/ms_check.c2
-rw-r--r--src/core/ms_del.c30
-rw-r--r--src/core/ms_help.c4
-rw-r--r--src/core/ms_info.c2
-rw-r--r--src/core/ms_list.c34
-rw-r--r--src/core/ms_read.c36
-rw-r--r--src/core/ms_rsend.c2
-rw-r--r--src/core/ms_send.c2
-rw-r--r--src/core/ms_sendall.c2
-rw-r--r--src/core/ms_set.c93
-rw-r--r--src/core/ms_staff.c2
-rw-r--r--src/core/ns_access.c26
-rw-r--r--src/core/ns_alist.c20
-rw-r--r--src/core/ns_drop.c2
-rw-r--r--src/core/ns_forbid.c2
-rw-r--r--src/core/ns_getemail.c12
-rw-r--r--src/core/ns_getpass.c2
-rw-r--r--src/core/ns_ghost.c2
-rw-r--r--src/core/ns_group.c4
-rw-r--r--src/core/ns_help.c8
-rw-r--r--src/core/ns_identify.c2
-rw-r--r--src/core/ns_info.c8
-rw-r--r--src/core/ns_list.c13
-rw-r--r--src/core/ns_logout.c6
-rw-r--r--src/core/ns_recover.c2
-rw-r--r--src/core/ns_register.c10
-rw-r--r--src/core/ns_release.c2
-rw-r--r--src/core/ns_saset.c155
-rw-r--r--src/core/ns_sendpass.c2
-rw-r--r--src/core/ns_set.c140
-rw-r--r--src/core/ns_status.c2
-rw-r--r--src/core/ns_suspend.c4
-rw-r--r--src/core/ns_update.c4
-rw-r--r--src/core/os_akill.c26
-rw-r--r--src/core/os_chankill.c2
-rw-r--r--src/core/os_chanlist.c6
-rw-r--r--src/core/os_clearmodes.c9
-rw-r--r--src/core/os_defcon.c2
-rw-r--r--src/core/os_global.c2
-rw-r--r--src/core/os_help.c4
-rw-r--r--src/core/os_ignore.c24
-rw-r--r--src/core/os_jupe.c2
-rw-r--r--src/core/os_kick.c2
-rw-r--r--src/core/os_mode.c4
-rw-r--r--src/core/os_modinfo.c2
-rw-r--r--src/core/os_modlist.c18
-rw-r--r--src/core/os_modload.c2
-rw-r--r--src/core/os_modunload.c2
-rw-r--r--src/core/os_news.c30
-rw-r--r--src/core/os_noop.c8
-rw-r--r--src/core/os_oline.c2
-rw-r--r--src/core/os_quit.c2
-rw-r--r--src/core/os_reload.c2
-rw-r--r--src/core/os_restart.c3
-rw-r--r--src/core/os_session.c39
-rw-r--r--src/core/os_set.c88
-rw-r--r--src/core/os_sgline.c26
-rw-r--r--src/core/os_shutdown.c2
-rw-r--r--src/core/os_sqline.c26
-rw-r--r--src/core/os_staff.c2
-rw-r--r--src/core/os_stats.c40
-rw-r--r--src/core/os_svsnick.c2
-rw-r--r--src/core/os_szline.c26
-rw-r--r--src/core/os_umode.c2
-rw-r--r--src/core/os_update.c2
-rw-r--r--src/core/os_userlist.c6
-rw-r--r--src/core/ss_main.c4
-rw-r--r--src/modules/cs_appendtopic.c2
-rw-r--r--src/modules/cs_enforce.c24
-rw-r--r--src/modules/cs_tban.c2
-rw-r--r--src/modules/hs_request.c20
-rw-r--r--src/modules/ns_maxemail.c6
-rw-r--r--src/modules/os_info.c26
120 files changed, 777 insertions, 851 deletions
diff --git a/include/modules.h b/include/modules.h
index 61eab28df..23152df95 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -249,7 +249,7 @@ class CoreExport Command
/** Execute this command.
* @param u The user executing the command.
*/
- virtual CommandReturn Execute(User *u, std::vector<std::string> &);
+ virtual CommandReturn Execute(User *u, std::vector<ci::string> &);
/** Requested when the user is requesting help on this command. Help on this command should be sent to the user.
* @param u The user requesting help
@@ -519,7 +519,7 @@ class CoreExport Module
* @param params The parameters the user is sending
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
- virtual EventReturn OnPreCommand(User *u, const std::string &service, const std::string &command, const std::vector<std::string> &params) { return EVENT_CONTINUE; }
+ virtual EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> &params) { return EVENT_CONTINUE; }
/** Called after a command has been executed.
* @param u The user executing the command
@@ -527,7 +527,7 @@ class CoreExport Module
* @param command The command the user executed
* @param params The parameters the user sent
*/
- virtual void OnPostCommand(User *u, const std::string &service, const std::string &command, const std::vector<std::string> &params) { }
+ virtual void OnPostCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> &params) { }
/** Called when anope saves databases.
* NOTE: This event is deprecated pending new database handling.
diff --git a/src/command.cpp b/src/command.cpp
index 26b464483..f3bc7ad1f 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -34,7 +34,7 @@ Command::~Command()
}
}
-CommandReturn Command::Execute(User *u, std::vector<std::string> &) { return MOD_CONT; }
+CommandReturn Command::Execute(User *u, std::vector<ci::string> &) { return MOD_CONT; }
bool Command::OnHelp(User *u, const ci::string &subcommand) { return false; }
diff --git a/src/commands.c b/src/commands.c
index 17f854a99..a564b644e 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -88,7 +88,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char *
// Check whether or not access string is empty
}
- std::vector<std::string> params;
+ std::vector<ci::string> params;
std::string curparam;
char *s = NULL;
while ((s = strtok(NULL, " ")))
@@ -111,7 +111,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char *
curparam.erase(curparam.size() - 1, curparam.size());
// Add it
- params.push_back(curparam);
+ params.push_back(curparam.c_str());
}
if (params.size() < c->MinParams)
@@ -121,7 +121,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char *
}
EventReturn MOD_RESULT = EVENT_CONTINUE;
- FOREACH_RESULT(I_OnPreCommand, OnPreCommand(u, c->service, c->name, params));
+ FOREACH_RESULT(I_OnPreCommand, OnPreCommand(u, c->service, c->name.c_str(), params));
if (MOD_RESULT == EVENT_STOP)
return;
@@ -174,7 +174,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char *
retVal = c->Execute(u, params);
- FOREACH_MOD(I_OnPostCommand, OnPostCommand(u, c->service, c->name, params));
+ FOREACH_MOD(I_OnPostCommand, OnPostCommand(u, c->service, c->name.c_str(), params));
}
/*************************************************************************/
diff --git a/src/core/bs_act.c b/src/core/bs_act.c
index 21f18063b..b81e43c13 100644
--- a/src/core/bs_act.c
+++ b/src/core/bs_act.c
@@ -20,10 +20,9 @@ class CommandBSAct : public Command
public:
CommandBSAct() : Command("ACT", 2, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
ChannelInfo *ci = cs_findchan(params[0].c_str());
@@ -47,9 +46,7 @@ class CommandBSAct : public Command
size_t i = 0;
while ((i = params[1].find_first_of("\001"), i) && i != std::string::npos)
- {
params[1].erase(i, 1);
- }
ircdproto->SendAction(ci->bi, ci->name, "%s", params[1].c_str());
ci->bi->lastmsg = time(NULL);
diff --git a/src/core/bs_assign.c b/src/core/bs_assign.c
index 20c5e3bb4..95ee8a9aa 100644
--- a/src/core/bs_assign.c
+++ b/src/core/bs_assign.c
@@ -22,7 +22,7 @@ class CommandBSAssign : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *nick = params[1].c_str();
diff --git a/src/core/bs_badwords.c b/src/core/bs_badwords.c
index bc22c0312..d174574d0 100644
--- a/src/core/bs_badwords.c
+++ b/src/core/bs_badwords.c
@@ -234,15 +234,15 @@ class CommandBSBadwords : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
const char *word = params.size() > 2 ? params[2].c_str() : NULL;
ChannelInfo *ci;
- int need_args = (cmd && (!stricmp(cmd, "LIST") || !stricmp(cmd, "CLEAR")));
+ bool need_args = cmd == "LIST" || cmd == "CLEAR";
- if (!cmd || (need_args ? 0 : !word))
+ if (need_args ? 0 : !word)
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -262,26 +262,16 @@ class CommandBSBadwords : public Command
return MOD_CONT;
}
- if (stricmp(cmd, "ADD") == 0)
- {
+ if (cmd == "ADD")
return this->DoAdd(u, ci, word);
- }
- else if (stricmp(cmd, "DEL") == 0)
- {
+ else if (cmd == "DEL")
return this->DoDelete(u, ci, word);
- }
- else if (stricmp(cmd, "LIST") == 0)
- {
+ else if (cmd == "LIST")
return this->DoList(u, ci, word);
- }
- else if (stricmp(cmd, "CLEAR") == 0)
- {
+ else if (cmd == "CLEAR")
return this->DoClear(u, ci, word);
- }
else
- {
this->OnSyntaxError(u);
- }
return MOD_CONT;
}
diff --git a/src/core/bs_bot.c b/src/core/bs_bot.c
index 787f5b131..fa2d7fab4 100644
--- a/src/core/bs_bot.c
+++ b/src/core/bs_bot.c
@@ -18,7 +18,7 @@
class CommandBSBot : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
const char *nick = params[1].c_str();
const char *user = params.size() > 2 ? params[2].c_str() : NULL;
@@ -135,7 +135,7 @@ class CommandBSBot : public Command
return MOD_CONT;
}
- CommandReturn DoChange(User *u, std::vector<std::string> &params)
+ CommandReturn DoChange(User *u, std::vector<ci::string> &params)
{
const char *oldnick = params[1].c_str();
const char *nick = params.size() > 2 ? params[2].c_str() : NULL;
@@ -315,7 +315,7 @@ class CommandBSBot : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *nick = params[1].c_str();
BotInfo *bi;
@@ -353,9 +353,9 @@ class CommandBSBot : public Command
this->SetFlag(CFLAG_STRIP_CHANNEL);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
if (readonly)
{
@@ -363,7 +363,7 @@ class CommandBSBot : public Command
return MOD_CONT;
}
- if (!stricmp(cmd, "ADD"))
+ if (cmd == "ADD")
{
// ADD nick user host real - 5
if (!u->nc->HasCommand("botserv/bot/add"))
@@ -384,7 +384,7 @@ class CommandBSBot : public Command
return this->DoAdd(u, params);
}
- else if (!stricmp(cmd, "CHANGE"))
+ else if (cmd == "CHANGE")
{
// CHANGE oldn newn user host real - 6
// but only oldn and newn are required
@@ -402,7 +402,7 @@ class CommandBSBot : public Command
return this->DoChange(u, params);
}
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
{
// DEL nick
if (!u->nc->HasCommand("botserv/bot/del"))
diff --git a/src/core/bs_botlist.c b/src/core/bs_botlist.c
index 5064642f6..b3125ec23 100644
--- a/src/core/bs_botlist.c
+++ b/src/core/bs_botlist.c
@@ -22,7 +22,7 @@ class CommandBSBotList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
int i, count = 0;
BotInfo *bi;
diff --git a/src/core/bs_help.c b/src/core/bs_help.c
index dde26b081..8d0572b79 100644
--- a/src/core/bs_help.c
+++ b/src/core/bs_help.c
@@ -6,8 +6,8 @@
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
- *
+ * Based on the original code of Services by Andy Church.
+ *
* $Id$
*
*/
@@ -23,8 +23,8 @@ class CommandBSHelp : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetFlag(CFLAG_STRIP_CHANNEL);
}
-
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
mod_help_cmd(s_BotServ, u, BOTSERV, params[0].c_str());
return MOD_CONT;
diff --git a/src/core/bs_info.c b/src/core/bs_info.c
index cad350cb2..de7e3e59e 100644
--- a/src/core/bs_info.c
+++ b/src/core/bs_info.c
@@ -52,7 +52,7 @@ class CommandBSInfo : public Command
this->SetFlag(CFLAG_STRIP_CHANNEL);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
BotInfo *bi;
ChannelInfo *ci;
diff --git a/src/core/bs_kick.c b/src/core/bs_kick.c
index 372a4ef7f..26b1d911c 100644
--- a/src/core/bs_kick.c
+++ b/src/core/bs_kick.c
@@ -24,28 +24,28 @@ class CommandBSKick : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *option = params[1].c_str();
- const char *value = params[2].c_str();
+ ci::string option = params[1];
+ ci::string value = params[2];
const char *ttb = params.size() > 3 ? params[3].c_str() : NULL;
ChannelInfo *ci = cs_findchan(chan);
if (readonly)
notice_lang(s_BotServ, u, BOT_KICK_DISABLED);
- else if (!chan || !option || !value)
+ else if (!chan || option.empty() || value.empty())
syntax_error(s_BotServ, u, "KICK", BOT_KICK_SYNTAX);
- else if (stricmp(value, "ON") && stricmp(value, "OFF"))
+ else if (value != "ON" && value != "OFF")
syntax_error(s_BotServ, u, "KICK", BOT_KICK_SYNTAX);
else if (!check_access(u, ci, CA_SET) && !u->nc->HasPriv("botserv/administration"))
notice_lang(s_BotServ, u, ACCESS_DENIED);
else if (!ci->bi)
notice_help(s_BotServ, u, BOT_NOT_ASSIGNED);
else {
- if (!stricmp(option, "BADWORDS")) {
- if (!stricmp(value, "ON")) {
+ if (option == "BADWORDS") {
+ if (value == "ON") {
if (ttb) {
ci->ttb[TTB_BADWORDS] =
strtol(ttb, NULL, 10);
@@ -74,8 +74,8 @@ class CommandBSKick : public Command
ci->botflags &= ~BS_KICK_BADWORDS;
notice_lang(s_BotServ, u, BOT_KICK_BADWORDS_OFF);
}
- } else if (!stricmp(option, "BOLDS")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "BOLDS") {
+ if (value == "ON") {
if (ttb) {
ci->ttb[TTB_BOLDS] = strtol(ttb, NULL, 10);
if (errno == ERANGE || errno == EINVAL
@@ -99,8 +99,8 @@ class CommandBSKick : public Command
ci->botflags &= ~BS_KICK_BOLDS;
notice_lang(s_BotServ, u, BOT_KICK_BOLDS_OFF);
}
- } else if (!stricmp(option, "CAPS")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "CAPS") {
+ if (value == "ON") {
char *min = strtok(NULL, " ");
char *percent = strtok(NULL, " ");
@@ -144,8 +144,8 @@ class CommandBSKick : public Command
ci->botflags &= ~BS_KICK_CAPS;
notice_lang(s_BotServ, u, BOT_KICK_CAPS_OFF);
}
- } else if (!stricmp(option, "COLORS")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "COLORS") {
+ if (value == "ON") {
if (ttb) {
ci->ttb[TTB_COLORS] = strtol(ttb, NULL, 10);
if (errno == ERANGE || errno == EINVAL
@@ -169,8 +169,8 @@ class CommandBSKick : public Command
ci->botflags &= ~BS_KICK_COLORS;
notice_lang(s_BotServ, u, BOT_KICK_COLORS_OFF);
}
- } else if (!stricmp(option, "FLOOD")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "FLOOD") {
+ if (value == "ON") {
char *lines = strtok(NULL, " ");
char *secs = strtok(NULL, " ");
@@ -214,8 +214,8 @@ class CommandBSKick : public Command
ci->botflags &= ~BS_KICK_FLOOD;
notice_lang(s_BotServ, u, BOT_KICK_FLOOD_OFF);
}
- } else if (!stricmp(option, "REPEAT")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "REPEAT") {
+ if (value == "ON") {
char *times = strtok(NULL, " ");
if (ttb) {
@@ -250,8 +250,8 @@ class CommandBSKick : public Command
ci->botflags &= ~BS_KICK_REPEAT;
notice_lang(s_BotServ, u, BOT_KICK_REPEAT_OFF);
}
- } else if (!stricmp(option, "REVERSES")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "REVERSES") {
+ if (value == "ON") {
if (ttb) {
ci->ttb[TTB_REVERSES] =
strtol(ttb, NULL, 10);
@@ -276,8 +276,8 @@ class CommandBSKick : public Command
ci->botflags &= ~BS_KICK_REVERSES;
notice_lang(s_BotServ, u, BOT_KICK_REVERSES_OFF);
}
- } else if (!stricmp(option, "UNDERLINES")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "UNDERLINES") {
+ if (value == "ON") {
if (ttb) {
ci->ttb[TTB_UNDERLINES] =
strtol(ttb, NULL, 10);
@@ -303,7 +303,7 @@ class CommandBSKick : public Command
notice_lang(s_BotServ, u, BOT_KICK_UNDERLINES_OFF);
}
} else
- notice_help(s_BotServ, u, BOT_KICK_UNKNOWN, option);
+ notice_help(s_BotServ, u, BOT_KICK_UNKNOWN, option.c_str());
}
return MOD_CONT;
}
diff --git a/src/core/bs_say.c b/src/core/bs_say.c
index 6fd8f41c7..8a7f49c73 100644
--- a/src/core/bs_say.c
+++ b/src/core/bs_say.c
@@ -22,7 +22,7 @@ class CommandBSSay : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
ChannelInfo *ci;
@@ -37,7 +37,6 @@ class CommandBSSay : public Command
return MOD_CONT;
}
-
if (!ci->bi)
{
notice_help(s_BotServ, u, BOT_NOT_ASSIGNED);
diff --git a/src/core/bs_set.c b/src/core/bs_set.c
index c68a11688..c7c67714b 100644
--- a/src/core/bs_set.c
+++ b/src/core/bs_set.c
@@ -23,11 +23,11 @@ class CommandBSSet : public Command
this->SetFlag(CFLAG_STRIP_CHANNEL);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *option = params[1].c_str();
- const char *value = params[2].c_str();
+ ci::string option = params[1];
+ ci::string value = params[2];
ChannelInfo *ci;
if (readonly)
@@ -36,7 +36,7 @@ class CommandBSSet : public Command
return MOD_CONT;
}
- if (u->nc->HasCommand("botserv/set/private") && !stricmp(option, "PRIVATE"))
+ if (u->nc->HasCommand("botserv/set/private") && option == "PRIVATE")
{
BotInfo *bi;
@@ -46,12 +46,12 @@ class CommandBSSet : public Command
return MOD_CONT;
}
- if (!stricmp(value, "ON"))
+ if (value == "ON")
{
bi->flags |= BI_PRIVATE;
notice_lang(s_BotServ, u, BOT_SET_PRIVATE_ON, bi->nick);
}
- else if (!stricmp(value, "OFF"))
+ else if (value == "OFF")
{
bi->flags &= ~BI_PRIVATE;
notice_lang(s_BotServ, u, BOT_SET_PRIVATE_OFF, bi->nick);
@@ -66,12 +66,12 @@ class CommandBSSet : public Command
else if (!u->nc->HasPriv("botserv/administration") && !check_access(u, ci, CA_SET))
notice_lang(s_BotServ, u, ACCESS_DENIED);
else {
- if (!stricmp(option, "DONTKICKOPS")) {
- if (!stricmp(value, "ON")) {
+ if (option == "DONTKICKOPS") {
+ if (value == "ON") {
ci->botflags |= BS_DONTKICKOPS;
notice_lang(s_BotServ, u, BOT_SET_DONTKICKOPS_ON,
ci->name);
- } else if (!stricmp(value, "OFF")) {
+ } else if (value == "OFF") {
ci->botflags &= ~BS_DONTKICKOPS;
notice_lang(s_BotServ, u, BOT_SET_DONTKICKOPS_OFF,
ci->name);
@@ -79,12 +79,12 @@ class CommandBSSet : public Command
syntax_error(s_BotServ, u, "SET DONTKICKOPS",
BOT_SET_DONTKICKOPS_SYNTAX);
}
- } else if (!stricmp(option, "DONTKICKVOICES")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "DONTKICKVOICES") {
+ if (value == "ON") {
ci->botflags |= BS_DONTKICKVOICES;
notice_lang(s_BotServ, u, BOT_SET_DONTKICKVOICES_ON,
ci->name);
- } else if (!stricmp(value, "OFF")) {
+ } else if (value == "OFF") {
ci->botflags &= ~BS_DONTKICKVOICES;
notice_lang(s_BotServ, u, BOT_SET_DONTKICKVOICES_OFF,
ci->name);
@@ -92,46 +92,46 @@ class CommandBSSet : public Command
syntax_error(s_BotServ, u, "SET DONTKICKVOICES",
BOT_SET_DONTKICKVOICES_SYNTAX);
}
- } else if (!stricmp(option, "FANTASY")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "FANTASY") {
+ if (value == "ON") {
ci->botflags |= BS_FANTASY;
notice_lang(s_BotServ, u, BOT_SET_FANTASY_ON, ci->name);
- } else if (!stricmp(value, "OFF")) {
+ } else if (value == "OFF") {
ci->botflags &= ~BS_FANTASY;
notice_lang(s_BotServ, u, BOT_SET_FANTASY_OFF, ci->name);
} else {
syntax_error(s_BotServ, u, "SET FANTASY",
BOT_SET_FANTASY_SYNTAX);
}
- } else if (!stricmp(option, "GREET")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "GREET") {
+ if (value == "ON") {
ci->botflags |= BS_GREET;
notice_lang(s_BotServ, u, BOT_SET_GREET_ON, ci->name);
- } else if (!stricmp(value, "OFF")) {
+ } else if (value == "OFF") {
ci->botflags &= ~BS_GREET;
notice_lang(s_BotServ, u, BOT_SET_GREET_OFF, ci->name);
} else {
syntax_error(s_BotServ, u, "SET GREET",
BOT_SET_GREET_SYNTAX);
}
- } else if (u->nc->HasCommand("botserv/set/nobot") && !stricmp(option, "NOBOT")) {
- if (!stricmp(value, "ON")) {
+ } else if (u->nc->HasCommand("botserv/set/nobot") && option == "NOBOT") {
+ if (value == "ON") {
ci->botflags |= BS_NOBOT;
if (ci->bi)
ci->bi->UnAssign(u, ci);
notice_lang(s_BotServ, u, BOT_SET_NOBOT_ON, ci->name);
- } else if (!stricmp(value, "OFF")) {
+ } else if (value == "OFF") {
ci->botflags &= ~BS_NOBOT;
notice_lang(s_BotServ, u, BOT_SET_NOBOT_OFF, ci->name);
} else {
syntax_error(s_BotServ, u, "SET NOBOT",
BOT_SET_NOBOT_SYNTAX);
}
- } else if (!stricmp(option, "SYMBIOSIS")) {
- if (!stricmp(value, "ON")) {
+ } else if (option == "SYMBIOSIS") {
+ if (value == "ON") {
ci->botflags |= BS_SYMBIOSIS;
notice_lang(s_BotServ, u, BOT_SET_SYMBIOSIS_ON, ci->name);
- } else if (!stricmp(value, "OFF")) {
+ } else if (value == "OFF") {
ci->botflags &= ~BS_SYMBIOSIS;
notice_lang(s_BotServ, u, BOT_SET_SYMBIOSIS_OFF, ci->name);
} else {
@@ -139,7 +139,7 @@ class CommandBSSet : public Command
BOT_SET_SYMBIOSIS_SYNTAX);
}
} else {
- notice_help(s_BotServ, u, BOT_SET_UNKNOWN, option);
+ notice_help(s_BotServ, u, BOT_SET_UNKNOWN, option.c_str());
}
}
return MOD_CONT;
diff --git a/src/core/bs_unassign.c b/src/core/bs_unassign.c
index 83771fc9d..198a625b6 100644
--- a/src/core/bs_unassign.c
+++ b/src/core/bs_unassign.c
@@ -24,7 +24,7 @@ class CommandBSUnassign : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
ChannelInfo *ci = cs_findchan(chan);
diff --git a/src/core/cs_access.c b/src/core/cs_access.c
index c2b5d93f2..40014b558 100644
--- a/src/core/cs_access.c
+++ b/src/core/cs_access.c
@@ -88,10 +88,10 @@ class CommandCSAccess : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
const char *nick = params.size() > 2 ? params[2].c_str() : NULL;
const char *s = params.size() > 3 ? params[3].c_str() : NULL;
@@ -102,12 +102,12 @@ class CommandCSAccess : public Command
unsigned i;
int level = 0, ulev;
- int is_list = (cmd && !stricmp(cmd, "LIST"));
+ bool is_list = cmd == "LIST";
/* If LIST, we don't *require* any parameters, but we can take any.
* If DEL, we require a nick and no level.
* Else (ADD), we require a level (which implies a nick). */
- if (!cmd || ((is_list || !stricmp(cmd, "CLEAR")) ? 0 : (!stricmp(cmd, "DEL")) ? (!nick || s) : !s))
+ if (is_list || cmd == "CLEAR" ? 0 : (cmd == "DEL" ? (!nick || s) : !s))
this->OnSyntaxError(u);
/* We still allow LIST in xOP mode, but not others */
else if ((ci->flags & CI_XOP) && !is_list)
@@ -123,7 +123,7 @@ class CommandCSAccess : public Command
(!is_list && !check_access(u, ci, CA_ACCESS_CHANGE) && !u->nc->HasPriv("chanserv/access/modify"))
))
notice_lang(s_ChanServ, u, ACCESS_DENIED);
- else if (!stricmp(cmd, "ADD"))
+ else if (cmd == "ADD")
{
if (readonly)
{
@@ -200,7 +200,7 @@ class CommandCSAccess : public Command
alog("%s: %s!%s@%s (level %d) set access level %d to %s (group %s) on channel %s", s_ChanServ, u->nick, u->GetIdent().c_str(), u->host, ulev, level, na->nick, nc->display, ci->name);
notice_lang(s_ChanServ, u, CHAN_ACCESS_ADDED, nc->display, ci->name, level);
}
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
{
int deleted;
if (readonly)
@@ -281,7 +281,7 @@ class CommandCSAccess : public Command
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, u, (na->nick ? na->nick : NULL)));
}
}
- else if (!stricmp(cmd, "LIST"))
+ else if (cmd == "LIST")
{
int sent_header = 0;
@@ -307,7 +307,7 @@ class CommandCSAccess : public Command
else
notice_lang(s_ChanServ, u, CHAN_ACCESS_LIST_FOOTER, ci->name);
}
- else if (!stricmp(cmd, "CLEAR"))
+ else if (cmd == "CLEAR")
{
if (readonly)
{
@@ -357,10 +357,10 @@ class CommandCSLevels : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
const char *what = params.size() > 2 ? params[2].c_str() : NULL;
const char *s = params.size() > 3 ? params[3].c_str() : NULL;
char *error;
@@ -372,15 +372,13 @@ class CommandCSLevels : public Command
/* If SET, we want two extra parameters; if DIS[ABLE] or FOUNDER, we want only
* one; else, we want none.
*/
- if (!cmd
- || ((stricmp(cmd, "SET") == 0) ? !s
- : ((strnicmp(cmd, "DIS", 3) == 0)) ? (!what || s) : !!what)) {
+ if (cmd == "SET" ? !s : (cmd.substr(0, 3) == "DIS" ? (!what || s) : !!what))
this->OnSyntaxError(u);
- } else if (ci->flags & CI_XOP) {
+ else if (ci->flags & CI_XOP)
notice_lang(s_ChanServ, u, CHAN_LEVELS_XOP);
- } else if (!is_founder(u, ci) && !u->nc->HasPriv("chanserv/access/modify")) {
+ else if (!is_founder(u, ci) && !u->nc->HasPriv("chanserv/access/modify"))
notice_lang(s_ChanServ, u, ACCESS_DENIED);
- } else if (stricmp(cmd, "SET") == 0) {
+ else if (cmd == "SET") {
level = strtol(s, &error, 10);
if (*error != '\0') {
@@ -409,7 +407,7 @@ class CommandCSLevels : public Command
notice_lang(s_ChanServ, u, CHAN_LEVELS_UNKNOWN, what, s_ChanServ);
- } else if (stricmp(cmd, "DIS") == 0 || stricmp(cmd, "DISABLE") == 0) {
+ } else if (cmd == "DIS" || cmd == "DISABLE") {
for (i = 0; levelinfo[i].what >= 0; i++) {
if (stricmp(levelinfo[i].name, what) == 0) {
ci->levels[levelinfo[i].what] = ACCESS_INVALID;
@@ -424,7 +422,7 @@ class CommandCSLevels : public Command
}
notice_lang(s_ChanServ, u, CHAN_LEVELS_UNKNOWN, what, s_ChanServ);
- } else if (stricmp(cmd, "LIST") == 0) {
+ } else if (cmd == "LIST") {
notice_lang(s_ChanServ, u, CHAN_LEVELS_LIST_HEADER, chan);
if (!levelinfo_maxwidth) {
@@ -458,7 +456,7 @@ class CommandCSLevels : public Command
}
}
- } else if (stricmp(cmd, "RESET") == 0) {
+ } else if (cmd == "RESET") {
reset_levels(ci);
alog("%s: %s!%s@%s reset levels definitions on channel %s",
diff --git a/src/core/cs_akick.c b/src/core/cs_akick.c
index d396d0386..4f91beb8d 100644
--- a/src/core/cs_akick.c
+++ b/src/core/cs_akick.c
@@ -173,10 +173,10 @@ class CommandCSAKick : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
const char *mask = params.size() > 2 ? params[2].c_str() : NULL;
const char *reason = NULL;
@@ -196,15 +196,11 @@ class CommandCSAKick : public Command
const char *argv[3];
int count = 0;
- if (!cmd || (!mask && (!stricmp(cmd, "ADD") || !stricmp(cmd, "STICK")
- || !stricmp(cmd, "UNSTICK")
- || !stricmp(cmd, "DEL")))) {
-
+ if (!mask && (cmd == "ADD" || cmd == "STICK" || cmd == "UNSTICK" || cmd == "DEL"))
syntax_error(s_ChanServ, u, "AKICK", CHAN_AKICK_SYNTAX);
- } else if (!check_access(u, ci, CA_AKICK) && !u->nc->HasPriv("chanserv/access/modify"))
- {
+ else if (!check_access(u, ci, CA_AKICK) && !u->nc->HasPriv("chanserv/access/modify"))
notice_lang(s_ChanServ, u, ACCESS_DENIED);
- } else if (stricmp(cmd, "ADD") == 0) {
+ else if (cmd == "ADD") {
NickAlias *na = findnick(mask), *na2;
NickCore *nc = NULL;
const char *nick, *user, *host;
@@ -363,7 +359,7 @@ class CommandCSAKick : public Command
if (freemask)
delete [] mask;
- } else if (stricmp(cmd, "STICK") == 0) {
+ } else if (cmd == "STICK") {
NickAlias *na;
NickCore *nc;
@@ -399,7 +395,7 @@ class CommandCSAKick : public Command
if (ci->c)
stick_mask(ci, akick);
- } else if (stricmp(cmd, "UNSTICK") == 0) {
+ } else if (cmd == "UNSTICK") {
NickAlias *na;
NickCore *nc;
@@ -433,7 +429,7 @@ class CommandCSAKick : public Command
notice_lang(s_ChanServ, u, CHAN_AKICK_UNSTUCK, akick->u.mask,
ci->name);
- } else if (stricmp(cmd, "DEL") == 0) {
+ } else if (cmd == "DEL") {
int deleted, a, b;
if (readonly) {
@@ -531,7 +527,7 @@ class CommandCSAKick : public Command
ci->akick =
static_cast<AutoKick *>(srealloc(ci->akick,sizeof(AutoKick) * ci->akickcount));
}
- } else if (stricmp(cmd, "LIST") == 0) {
+ } else if (cmd == "LIST") {
int sent_header = 0;
if (ci->akickcount == 0) {
@@ -561,7 +557,7 @@ class CommandCSAKick : public Command
if (!sent_header)
notice_lang(s_ChanServ, u, CHAN_AKICK_NO_MATCH, chan);
- } else if (stricmp(cmd, "VIEW") == 0) {
+ } else if (cmd == "VIEW") {
int sent_header = 0;
if (ci->akickcount == 0) {
notice_lang(s_ChanServ, u, CHAN_AKICK_LIST_EMPTY, chan);
@@ -590,7 +586,7 @@ class CommandCSAKick : public Command
if (!sent_header)
notice_lang(s_ChanServ, u, CHAN_AKICK_NO_MATCH, chan);
- } else if (stricmp(cmd, "ENFORCE") == 0) {
+ } else if (cmd == "ENFORCE") {
c = findchan(ci->name);
cu = NULL;
count = 0;
@@ -622,8 +618,7 @@ class CommandCSAKick : public Command
notice_lang(s_ChanServ, u, CHAN_AKICK_ENFORCE_DONE, chan, count);
- } else if (stricmp(cmd, "CLEAR") == 0) {
-
+ } else if (cmd == "CLEAR") {
if (readonly) {
notice_lang(s_ChanServ, u, CHAN_AKICK_DISABLED);
return MOD_CONT;
diff --git a/src/core/cs_ban.c b/src/core/cs_ban.c
index d69b0540c..5032680a7 100644
--- a/src/core/cs_ban.c
+++ b/src/core/cs_ban.c
@@ -20,10 +20,9 @@ class CommandCSBan : public Command
public:
CommandCSBan() : Command("BAN", 2, 3)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *target = params[1].c_str();
@@ -33,7 +32,6 @@ class CommandCSBan : public Command
{
params[2].resize(200);
reason = params[2].c_str();
-
}
Channel *c = findchan(chan);
@@ -122,7 +120,7 @@ class CommandCSUnban : public Command
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
Channel *c;
diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c
index 6aee7a93d..076a5cd34 100644
--- a/src/core/cs_clear.c
+++ b/src/core/cs_clear.c
@@ -23,10 +23,10 @@ class CommandCSClear : public Command
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *what = params[1].c_str();
+ ci::string what = params[1];
Channel *c = findchan(chan);
ChannelInfo *ci;
@@ -37,7 +37,7 @@ class CommandCSClear : public Command
notice_lang(s_ChanServ, u, CHAN_X_NOT_IN_USE, chan);
} else if (!u || !check_access(u, ci, CA_CLEAR)) {
notice_lang(s_ChanServ, u, ACCESS_DENIED);
- } else if (stricmp(what, "bans") == 0) {
+ } else if (what == "bans") {
const char *av[2];
Entry *ban, *bnext;
@@ -52,7 +52,7 @@ class CommandCSClear : public Command
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_BANS, chan);
- } else if (ircd->except && stricmp(what, "excepts") == 0) {
+ } else if (ircd->except && what == "excepts") {
const char *av[2];
Entry *except, *bnext;
@@ -67,7 +67,7 @@ class CommandCSClear : public Command
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_EXCEPTS, chan);
- } else if (ircd->invitemode && stricmp(what, "invites") == 0) {
+ } else if (ircd->invitemode && what == "invites") {
const char *av[2];
Entry *invite, *bnext;
@@ -82,7 +82,7 @@ class CommandCSClear : public Command
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_INVITES, chan);
- } else if (stricmp(what, "modes") == 0) {
+ } else if (what == "modes") {
const char *argv[2];
if (c->mode) {
@@ -124,7 +124,7 @@ class CommandCSClear : public Command
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_MODES, chan);
- } else if (stricmp(what, "ops") == 0) {
+ } else if (what == "ops") {
const char *av[6]; /* The max we have to hold: chan, ts, modes(max3), nick, nick, nick */
int ac, isop, isadmin, isown, count, i;
char buf[BUFSIZE], tmp[BUFSIZE], tmp2[BUFSIZE];
@@ -212,7 +212,7 @@ class CommandCSClear : public Command
}
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_OPS, chan);
- } else if (ircd->halfop && stricmp(what, "hops") == 0) {
+ } else if (ircd->halfop && what == "hops") {
const char *av[4];
int ac;
char buf[BUFSIZE];
@@ -256,7 +256,7 @@ class CommandCSClear : public Command
do_cmode(s_ChanServ, ac, av);
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_HOPS, chan);
- } else if (stricmp(what, "voices") == 0) {
+ } else if (what == "voices") {
const char *av[4];
int ac;
char buf[BUFSIZE];
@@ -301,7 +301,7 @@ class CommandCSClear : public Command
do_cmode(s_ChanServ, ac, av);
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_VOICES, chan);
- } else if (stricmp(what, "users") == 0) {
+ } else if (what == "users") {
const char *av[3];
struct c_userlist *cu, *bnext;
char buf[256];
diff --git a/src/core/cs_drop.c b/src/core/cs_drop.c
index fcf7a9a80..7eb6320c0 100644
--- a/src/core/cs_drop.c
+++ b/src/core/cs_drop.c
@@ -24,7 +24,7 @@ class CommandCSDrop : public Command
this->SetFlag(CFLAG_ALLOW_SUSPENDED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
ChannelInfo *ci;
@@ -108,8 +108,6 @@ class CommandCSDrop : public Command
}
};
-
-
class CSDrop : public Module
{
public:
@@ -126,7 +124,4 @@ class CSDrop : public Module
}
};
-
-
-
MODULE_INIT("cs_drop", CSDrop)
diff --git a/src/core/cs_forbid.c b/src/core/cs_forbid.c
index 5e834462c..6b2796b6c 100644
--- a/src/core/cs_forbid.c
+++ b/src/core/cs_forbid.c
@@ -20,10 +20,9 @@ class CommandCSForbid : public Command
public:
CommandCSForbid() : Command("FORBID", 1, 2, "chanserv/forbid")
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
ChannelInfo *ci;
const char *chan = params[0].c_str();
@@ -53,7 +52,6 @@ class CommandCSForbid : public Command
{
notice_lang(s_ChanServ, u, READ_ONLY_MODE);
return MOD_CONT;
-
}
if ((ci = cs_findchan(chan)) != NULL)
@@ -136,5 +134,4 @@ class CSForbid : public Module
}
};
-
MODULE_INIT("cs_forbid", CSForbid)
diff --git a/src/core/cs_getkey.c b/src/core/cs_getkey.c
index a5be26419..7fa654858 100644
--- a/src/core/cs_getkey.c
+++ b/src/core/cs_getkey.c
@@ -20,10 +20,9 @@ class CommandCSGetKey : public Command
public:
CommandCSGetKey() : Command("GETKEY", 1, 1)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
ChannelInfo *ci;
diff --git a/src/core/cs_getpass.c b/src/core/cs_getpass.c
index 5f6cd7652..cc1dfb89f 100644
--- a/src/core/cs_getpass.c
+++ b/src/core/cs_getpass.c
@@ -23,7 +23,7 @@ class CommandCSGetPass : public Command
this->SetFlag(CFLAG_ALLOW_SUSPENDED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
char tmp_pass[PASSMAX];
diff --git a/src/core/cs_help.c b/src/core/cs_help.c
index 2cc334f65..dd7c21f84 100644
--- a/src/core/cs_help.c
+++ b/src/core/cs_help.c
@@ -24,11 +24,11 @@ class CommandCSHelp : public Command
this->SetFlag(CFLAG_STRIP_CHANNEL);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!stricmp(cmd, "LEVELS DESC"))
+ if (cmd == "LEVELS DESC")
{
int i;
notice_help(s_ChanServ, u, CHAN_HELP_LEVELS_DESC);
@@ -47,7 +47,7 @@ class CommandCSHelp : public Command
}
}
else
- mod_help_cmd(s_ChanServ, u, CHANSERV, cmd);
+ mod_help_cmd(s_ChanServ, u, CHANSERV, cmd.c_str());
return MOD_CONT;
}
diff --git a/src/core/cs_identify.c b/src/core/cs_identify.c
index 621446703..63f9ac823 100644
--- a/src/core/cs_identify.c
+++ b/src/core/cs_identify.c
@@ -20,10 +20,9 @@ class CommandCSIdentify : public Command
public:
CommandCSIdentify(const std::string &cname) : Command(cname, 2, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *pass = params[1].c_str();
diff --git a/src/core/cs_info.c b/src/core/cs_info.c
index f33e74c79..9a7cc9bcc 100644
--- a/src/core/cs_info.c
+++ b/src/core/cs_info.c
@@ -37,10 +37,10 @@ class CommandCSInfo : public Command
this->SetFlag(CFLAG_ALLOW_FORBIDDEN);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
ChannelInfo *ci;
char buf[BUFSIZE];
struct tm *tm;
@@ -63,9 +63,8 @@ class CommandCSInfo : public Command
return MOD_CONT;
}
-
/* Should we show all fields? Only for sadmins and identified users */
- if (param && stricmp(param, "ALL") == 0 && (check_access(u, ci, CA_INFO) || has_auspex))
+ if (!param.empty() && param == "ALL" && (check_access(u, ci, CA_INFO) || has_auspex))
show_all = 1;
notice_lang(s_ChanServ, u, CHAN_INFO_HEADER, chan);
@@ -158,8 +157,6 @@ class CommandCSInfo : public Command
}
};
-
-
class CSInfo : public Module
{
public:
@@ -176,7 +173,4 @@ class CSInfo : public Module
}
};
-
-
-
MODULE_INIT("cs_info", CSInfo)
diff --git a/src/core/cs_invite.c b/src/core/cs_invite.c
index cfaedd3d8..95ab1e371 100644
--- a/src/core/cs_invite.c
+++ b/src/core/cs_invite.c
@@ -20,9 +20,9 @@ class CommandCSInvite : public Command
public:
CommandCSInvite() : Command("INVITE", 1, 1)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
Channel *c;
@@ -64,9 +64,6 @@ class CommandCSInvite : public Command
}
};
-
-
-
class CSInvite : public Module
{
public:
@@ -83,6 +80,4 @@ class CSInvite : public Module
}
};
-
-
MODULE_INIT("cs_invite", CSInvite)
diff --git a/src/core/cs_kick.c b/src/core/cs_kick.c
index 5cbe007a0..3006c9b08 100644
--- a/src/core/cs_kick.c
+++ b/src/core/cs_kick.c
@@ -20,10 +20,9 @@ class CommandCSKick : public Command
public:
CommandCSKick() : Command("KICK", 2, 3)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *target = params[1].c_str();
diff --git a/src/core/cs_list.c b/src/core/cs_list.c
index dcb2ca1bc..4624bcf4c 100644
--- a/src/core/cs_list.c
+++ b/src/core/cs_list.c
@@ -19,12 +19,12 @@
class CommandCSList : public Command
{
public:
- CommandCSList() : Command("LIST",1,2)
+ CommandCSList() : Command("LIST", 1, 2)
{
this->SetFlag(CFLAG_STRIP_CHANNEL);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *pattern = params[0].c_str();
int spattern_size;
@@ -93,14 +93,15 @@ public:
if (is_servadmin && params.size() > 1)
{
std::string keyword;
- spacesepstream keywords(params[1]);
+ spacesepstream keywords(params[1].c_str());
while (keywords.GetToken(keyword))
{
- if (stricmp(keyword.c_str(), "FORBIDDEN") == 0)
+ ci::string keyword_ci = keyword.c_str();
+ if (keyword_ci == "FORBIDDEN")
matchflags |= CI_FORBIDDEN;
- if (stricmp(keyword.c_str(), "SUSPENDED") == 0)
+ if (keyword_ci == "SUSPENDED")
matchflags |= CI_SUSPENDED;
- if (stricmp(keyword.c_str(), "NOEXPIRE") == 0)
+ if (keyword_ci == "NOEXPIRE")
matchflags |= CI_NO_EXPIRE;
}
@@ -110,7 +111,6 @@ public:
spattern = new char[spattern_size];
snprintf(spattern, spattern_size, "#%s", pattern);
-
notice_lang(s_ChanServ, u, CHAN_LIST_HEADER, pattern);
for (i = 0; i < 256; i++)
{
diff --git a/src/core/cs_logout.c b/src/core/cs_logout.c
index 46483b0f7..0418b8ff5 100644
--- a/src/core/cs_logout.c
+++ b/src/core/cs_logout.c
@@ -47,10 +47,9 @@ class CommandCSLogout : public Command
public:
CommandCSLogout() : Command("LOGOUT", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *nick = params.size() > 1 ? params[1].c_str() : NULL;
diff --git a/src/core/cs_modes.c b/src/core/cs_modes.c
index e71031d28..3ab2d1528 100644
--- a/src/core/cs_modes.c
+++ b/src/core/cs_modes.c
@@ -71,10 +71,9 @@ class CommandCSOp : public Command
public:
CommandCSOp() : Command("OP", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return do_util(u, &csmodeutils[MUT_OP], (params.size() > 0 ? params[0].c_str() : NULL), (params.size() > 1 ? params[1].c_str() : NULL));
}
@@ -97,10 +96,9 @@ class CommandCSDeOp : public Command
public:
CommandCSDeOp() : Command("DEOP", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return do_util(u, &csmodeutils[MUT_DEOP], (params.size() > 0 ? params[0].c_str() : NULL), (params.size() > 1 ? params[1].c_str() : NULL));
}
@@ -123,10 +121,9 @@ class CommandCSVoice : public Command
public:
CommandCSVoice() : Command("VOICE", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return do_util(u, &csmodeutils[MUT_VOICE], (params.size() > 0 ? params[0].c_str() : NULL), (params.size() > 1 ? params[1].c_str() : NULL));
}
@@ -149,10 +146,9 @@ class CommandCSDeVoice : public Command
public:
CommandCSDeVoice() : Command("DEVOICE", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return do_util(u, &csmodeutils[MUT_DEVOICE], (params.size() > 0 ? params[0].c_str() : NULL), (params.size() > 1 ? params[1].c_str() : NULL));
}
@@ -175,15 +171,13 @@ class CommandCSHalfOp : public Command
public:
CommandCSHalfOp() : Command("HALFOP", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
if (!ircd->halfop)
{
return MOD_CONT;
-
}
return do_util(u, &csmodeutils[MUT_HALFOP], (params.size() > 0 ? params[0].c_str() : NULL), (params.size() > 1 ? params[1].c_str() : NULL));
@@ -207,10 +201,9 @@ class CommandCSDeHalfOp : public Command
public:
CommandCSDeHalfOp() : Command("DEHALFOP", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
if (!ircd->halfop)
{
@@ -238,10 +231,9 @@ class CommandCSProtect : public Command
public:
CommandCSProtect() : Command("PROTECT", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
if (!ircd->protect && !ircd->admin)
{
@@ -270,10 +262,9 @@ class CommandCSDeProtect : public Command
public:
CommandCSDeProtect() : Command("DEPROTECT", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
if (!ircd->protect && !ircd->admin)
{
@@ -302,10 +293,9 @@ class CommandCSOwner : public Command
public:
CommandCSOwner() : Command("OWNER", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return do_util(u, &csmodeutils[MUT_OWNER], (params.size() > 0 ? params[0].c_str() : NULL), NULL);
}
@@ -329,10 +319,9 @@ class CommandCSDeOwner : public Command
public:
CommandCSDeOwner() : Command("DEOWNER", 1, 2)
{
-
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return do_util(u, &csmodeutils[MUT_DEOWNER], (params.size() > 0 ? params[0].c_str() : NULL), NULL);
}
diff --git a/src/core/cs_register.c b/src/core/cs_register.c
index 4cb2c0d1e..4949502e2 100644
--- a/src/core/cs_register.c
+++ b/src/core/cs_register.c
@@ -23,7 +23,7 @@ class CommandCSRegister : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTEREDCHANNEL);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *pass = params[1].c_str();
@@ -70,7 +70,6 @@ class CommandCSRegister : public Command
{
alog("%s: makechan() failed for REGISTER %s", s_ChanServ, chan);
notice_lang(s_ChanServ, u, CHAN_REGISTRATION_FAILED);
-
}
else if (strscpy(founderpass, pass, PASSMAX), enc_encrypt_in_place(founderpass, PASSMAX) < 0)
{
diff --git a/src/core/cs_sendpass.c b/src/core/cs_sendpass.c
index 3e75653b2..4ea1da3be 100644
--- a/src/core/cs_sendpass.c
+++ b/src/core/cs_sendpass.c
@@ -22,7 +22,7 @@ class CommandCSSendPass : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
ChannelInfo *ci = cs_findchan(chan);
diff --git a/src/core/cs_set.c b/src/core/cs_set.c
index e44bfd7d3..1e36e859e 100644
--- a/src/core/cs_set.c
+++ b/src/core/cs_set.c
@@ -552,10 +552,10 @@ class CommandCSSet : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
const char *param = params.size() > 2 ? params[2].c_str() : NULL;
ChannelInfo *ci = cs_findchan(chan);
bool is_servadmin = u->nc->HasPriv("chanserv/set");
@@ -565,15 +565,11 @@ class CommandCSSet : public Command
return MOD_CONT;
}
- if (!param && (!cmd || (stricmp(cmd, "SUCCESSOR") != 0 &&
- stricmp(cmd, "URL") != 0 &&
- stricmp(cmd, "EMAIL") != 0 &&
- stricmp(cmd, "ENTRYMSG") != 0) &&
- stricmp(cmd, "MLOCK") != 0)) {
+ if (!param && cmd != "SUCCESSOR" && cmd != "URL" && cmd != "EMAIL" && cmd != "ENTRYMSG" && cmd != "MLOCK")
syntax_error(s_ChanServ, u, "SET", CHAN_SET_SYNTAX);
- } else if (!is_servadmin && !check_access(u, ci, CA_SET)) {
+ else if (!is_servadmin && !check_access(u, ci, CA_SET))
notice_lang(s_ChanServ, u, ACCESS_DENIED);
- } else if (stricmp(cmd, "FOUNDER") == 0) {
+ else if (cmd == "FOUNDER") {
if (!is_servadmin
&& (ci->
flags & CI_SECUREFOUNDER ? !is_real_founder(u,
@@ -583,7 +579,7 @@ class CommandCSSet : public Command
} else {
DoSetFounder(u, ci, param);
}
- } else if (stricmp(cmd, "SUCCESSOR") == 0) {
+ } else if (cmd == "SUCCESSOR") {
if (!is_servadmin
&& (ci->
flags & CI_SECUREFOUNDER ? !is_real_founder(u,
@@ -593,7 +589,7 @@ class CommandCSSet : public Command
} else {
DoSetSuccessor(u, ci, param);
}
- } else if (stricmp(cmd, "PASSWORD") == 0) {
+ } else if (cmd == "PASSWORD") {
if (!is_servadmin
&& (ci->
flags & CI_SECUREFOUNDER ? !is_real_founder(u,
@@ -603,29 +599,29 @@ class CommandCSSet : public Command
} else {
DoSetPassword(u, ci, param);
}
- } else if (stricmp(cmd, "DESC") == 0) {
+ } else if (cmd == "DESC") {
DoSetDesc(u, ci, param);
- } else if (stricmp(cmd, "URL") == 0) {
+ } else if (cmd == "URL") {
DoSetURL(u, ci, param);
- } else if (stricmp(cmd, "EMAIL") == 0) {
+ } else if (cmd == "EMAIL") {
DoSetEMail(u, ci, param);
- } else if (stricmp(cmd, "ENTRYMSG") == 0) {
+ } else if (cmd == "ENTRYMSG") {
DoSetEntryMsg(u, ci, param);
- } else if (stricmp(cmd, "TOPIC") == 0) {
+ } else if (cmd == "TOPIC") {
notice_lang(s_ChanServ, u, OBSOLETE_COMMAND, "TOPIC");
- } else if (stricmp(cmd, "BANTYPE") == 0) {
+ } else if (cmd == "BANTYPE") {
DoSetBanType(u, ci, param);
- } else if (stricmp(cmd, "MLOCK") == 0) {
+ } else if (cmd == "MLOCK") {
DoSetMLock(u, ci, param);
- } else if (stricmp(cmd, "KEEPTOPIC") == 0) {
+ } else if (cmd == "KEEPTOPIC") {
DoSetKeepTopic(u, ci, param);
- } else if (stricmp(cmd, "TOPICLOCK") == 0) {
+ } else if (cmd == "TOPICLOCK") {
DoSetTopicLock(u, ci, param);
- } else if (stricmp(cmd, "PRIVATE") == 0) {
+ } else if (cmd == "PRIVATE") {
DoSetPrivate(u, ci, param);
- } else if (stricmp(cmd, "SECUREOPS") == 0) {
+ } else if (cmd == "SECUREOPS") {
DoSetSecureOps(u, ci, param);
- } else if (stricmp(cmd, "SECUREFOUNDER") == 0) {
+ } else if (cmd == "SECUREFOUNDER") {
if (!is_servadmin
&& (ci->
flags & CI_SECUREFOUNDER ? !is_real_founder(u,
@@ -635,26 +631,26 @@ class CommandCSSet : public Command
} else {
DoSetSecureFounder(u, ci, param);
}
- } else if (stricmp(cmd, "RESTRICTED") == 0) {
+ } else if (cmd == "RESTRICTED") {
DoSetRestricted(u, ci, param);
- } else if (stricmp(cmd, "SECURE") == 0) {
+ } else if (cmd == "SECURE") {
DoSetSecure(u, ci, param);
- } else if (stricmp(cmd, "SIGNKICK") == 0) {
+ } else if (cmd == "SIGNKICK") {
DoSetSignKick(u, ci, param);
- } else if (stricmp(cmd, "OPNOTICE") == 0) {
+ } else if (cmd == "OPNOTICE") {
DoSetOpNotice(u, ci, param);
- } else if (stricmp(cmd, "XOP") == 0) {
+ } else if (cmd == "XOP") {
if (!(findModule("cs_xop"))) {
- notice_lang(s_ChanServ, u, CHAN_XOP_NOT_AVAILABLE, cmd);
+ notice_lang(s_ChanServ, u, CHAN_XOP_NOT_AVAILABLE, cmd.c_str());
} else {
DoSetXOP(u, ci, param);
}
- } else if (stricmp(cmd, "PEACE") == 0) {
+ } else if (cmd == "PEACE") {
DoSetPeace(u, ci, param);
- } else if (stricmp(cmd, "NOEXPIRE") == 0) {
+ } else if (cmd == "NOEXPIRE") {
DoSetNoExpire(u, ci, param);
} else {
- notice_lang(s_ChanServ, u, CHAN_SET_UNKNOWN_OPTION, cmd);
+ notice_lang(s_ChanServ, u, CHAN_SET_UNKNOWN_OPTION, cmd.c_str());
notice_lang(s_ChanServ, u, MORE_INFO, s_ChanServ, "SET");
}
return MOD_CONT;
diff --git a/src/core/cs_status.c b/src/core/cs_status.c
index 80cd223d6..d733d949a 100644
--- a/src/core/cs_status.c
+++ b/src/core/cs_status.c
@@ -22,7 +22,7 @@ class CommandCSStatus : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
ChannelInfo *ci;
User *u2;
diff --git a/src/core/cs_suspend.c b/src/core/cs_suspend.c
index 8ab2fa077..08b1ecddf 100644
--- a/src/core/cs_suspend.c
+++ b/src/core/cs_suspend.c
@@ -22,7 +22,7 @@ class CommandCSSuspend : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *reason = params.size() > 1 ? params[1].c_str() : NULL;
@@ -116,7 +116,7 @@ class CommandCSUnSuspend : public Command
this->SetFlag(CFLAG_ALLOW_SUSPENDED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
ChannelInfo *ci = cs_findchan(chan);
diff --git a/src/core/cs_topic.c b/src/core/cs_topic.c
index 6f3c05390..844ba12fd 100644
--- a/src/core/cs_topic.c
+++ b/src/core/cs_topic.c
@@ -22,7 +22,7 @@ class CommandCSTopic : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *topic = params.size() > 1 ? params[1].c_str() : NULL;
diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c
index 84687d79e..b83c44928 100644
--- a/src/core/cs_xop.c
+++ b/src/core/cs_xop.c
@@ -104,7 +104,7 @@ int xop_msgs[XOP_TYPES][XOP_MESSAGES] = {
class XOPBase : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params, ChannelInfo *ci, int level, int *messages)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params, ChannelInfo *ci, int level, int *messages)
{
const char *nick = params.size() > 2 ? params[2].c_str() : NULL;
ChanAccess *access;
@@ -187,7 +187,7 @@ class XOPBase : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params, ChannelInfo *ci, int level, int *messages)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params, ChannelInfo *ci, int level, int *messages)
{
const char *nick = params.size() > 2 ? params[2].c_str() : NULL;
ChanAccess *access;
@@ -286,7 +286,7 @@ class XOPBase : public Command
return MOD_CONT;
}
- CommandReturn DoList(User *u, std::vector<std::string> &params, ChannelInfo *ci, int level, int *messages)
+ CommandReturn DoList(User *u, std::vector<ci::string> &params, ChannelInfo *ci, int level, int *messages)
{
int sent_header = 0;
const char *nick = params.size() > 2 ? params[2].c_str() : NULL;
@@ -321,7 +321,7 @@ class XOPBase : public Command
return MOD_CONT;
}
- CommandReturn DoClear(User *u, std::vector<std::string> &params, ChannelInfo *ci, int level, int *messages)
+ CommandReturn DoClear(User *u, std::vector<ci::string> &params, ChannelInfo *ci, int level, int *messages)
{
if (readonly)
{
@@ -355,22 +355,22 @@ class XOPBase : public Command
return MOD_CONT;
}
protected:
- CommandReturn DoXop(User *u, std::vector<std::string> &params, int level, int *messages)
+ CommandReturn DoXop(User *u, std::vector<ci::string> &params, int level, int *messages)
{
const char *chan = params[0].c_str();
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
ChannelInfo *ci = cs_findchan(chan);
if (!(ci->flags & CI_XOP))
notice_lang(s_ChanServ, u, CHAN_XOP_ACCESS, s_ChanServ);
- else if (!stricmp(cmd, "ADD"))
+ else if (cmd == "ADD")
return this->DoAdd(u, params, ci, level, messages);
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->DoDel(u, params, ci, level, messages);
- else if (!stricmp(cmd, "LIST"))
+ else if (cmd == "LIST")
return this->DoList(u, params, ci, level, messages);
- else if (!stricmp(cmd, "CLEAR"))
+ else if (cmd == "CLEAR")
return this->DoClear(u, params, ci, level, messages);
else
this->OnSyntaxError(u);
@@ -385,7 +385,7 @@ class XOPBase : public Command
{
}
- virtual CommandReturn Execute(User *u, std::vector<std::string> &params) = 0;
+ virtual CommandReturn Execute(User *u, std::vector<ci::string> &params) = 0;
virtual bool OnHelp(User *u, const ci::string &subcommand) = 0;
@@ -399,7 +399,7 @@ class CommandCSAOP : public XOPBase
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoXop(u, params, ACCESS_AOP, xop_msgs[XOP_AOP]);
}
@@ -423,7 +423,7 @@ class CommandCSHOP : public XOPBase
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoXop(u, params, ACCESS_HOP, xop_msgs[XOP_HOP]);
}
@@ -447,7 +447,7 @@ class CommandCSSOP : public XOPBase
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoXop(u, params, ACCESS_SOP, xop_msgs[XOP_SOP]);
}
@@ -471,7 +471,7 @@ class CommandCSVOP : public XOPBase
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoXop(u, params, ACCESS_VOP, xop_msgs[XOP_VOP]);
}
diff --git a/src/core/hs_del.c b/src/core/hs_del.c
index 75f41b56d..83711335a 100644
--- a/src/core/hs_del.c
+++ b/src/core/hs_del.c
@@ -22,7 +22,7 @@ class CommandHSDel : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na;
const char *nick = params[0].c_str();
diff --git a/src/core/hs_delall.c b/src/core/hs_delall.c
index 8381c686c..05f256f34 100644
--- a/src/core/hs_delall.c
+++ b/src/core/hs_delall.c
@@ -22,7 +22,7 @@ class CommandHSDelAll : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
int i;
const char *nick = params[0].c_str();
diff --git a/src/core/hs_group.c b/src/core/hs_group.c
index 202f09d26..c63766e17 100644
--- a/src/core/hs_group.c
+++ b/src/core/hs_group.c
@@ -24,7 +24,7 @@ class CommandHSGroup : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na;
HostCore *tmp;
diff --git a/src/core/hs_help.c b/src/core/hs_help.c
index ca1f689ae..13b5e544f 100644
--- a/src/core/hs_help.c
+++ b/src/core/hs_help.c
@@ -23,9 +23,9 @@ class CommandHSHelp : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- mod_help_cmd(s_HostServ, u, HOSTSERV, params.size() > 0 ? params[0].c_str() : NULL);
+ mod_help_cmd(s_HostServ, u, HOSTSERV, params[0].c_str());
return MOD_CONT;
}
diff --git a/src/core/hs_list.c b/src/core/hs_list.c
index d68477865..69efbd320 100644
--- a/src/core/hs_list.c
+++ b/src/core/hs_list.c
@@ -22,7 +22,7 @@ class CommandHSList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *key = params.size() ? params[0].c_str() : NULL;
struct tm *tm;
diff --git a/src/core/hs_off.c b/src/core/hs_off.c
index 6acf9d096..086381fee 100644
--- a/src/core/hs_off.c
+++ b/src/core/hs_off.c
@@ -22,7 +22,7 @@ class CommandHSOff : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na;
char *vhost;
diff --git a/src/core/hs_on.c b/src/core/hs_on.c
index e946aba18..d1c2b391f 100644
--- a/src/core/hs_on.c
+++ b/src/core/hs_on.c
@@ -22,7 +22,7 @@ class CommandHSOn : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na;
char *vHost;
diff --git a/src/core/hs_set.c b/src/core/hs_set.c
index 025bbc044..eac1cbe3e 100644
--- a/src/core/hs_set.c
+++ b/src/core/hs_set.c
@@ -22,7 +22,7 @@ class CommandHSSet : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *rawhostmask = params[1].c_str();
diff --git a/src/core/hs_setall.c b/src/core/hs_setall.c
index 77c10fb37..3bb04f593 100644
--- a/src/core/hs_setall.c
+++ b/src/core/hs_setall.c
@@ -24,7 +24,7 @@ class CommandHSSetAll : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *rawhostmask = params[1].c_str();
diff --git a/src/core/ms_cancel.c b/src/core/ms_cancel.c
index 076501183..3626b852d 100644
--- a/src/core/ms_cancel.c
+++ b/src/core/ms_cancel.c
@@ -24,7 +24,7 @@ class CommandMSCancel : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
int ischan;
int isforbid;
diff --git a/src/core/ms_check.c b/src/core/ms_check.c
index cdb6944d7..4bc5bc731 100644
--- a/src/core/ms_check.c
+++ b/src/core/ms_check.c
@@ -22,7 +22,7 @@ class CommandMSCheck : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na = NULL;
MemoInfo *mi = NULL;
diff --git a/src/core/ms_del.c b/src/core/ms_del.c
index 6a7506aa2..d13e232e7 100644
--- a/src/core/ms_del.c
+++ b/src/core/ms_del.c
@@ -24,23 +24,23 @@ class CommandMSDel : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
MemoInfo *mi;
ChannelInfo *ci;
- const char *numstr = params.size() ? params[0].c_str() : NULL, *chan = NULL;
+ ci::string numstr = params.size() ? params[0] : "", chan;
int last, last0, i;
char buf[BUFSIZE], *end;
int delcount, count, left;
- if (numstr && *numstr == '#')
+ if (!numstr.empty() && numstr[0] == '#')
{
chan = numstr;
- numstr = params.size() > 1 ? params[1].c_str() : NULL;
+ numstr = params.size() > 1 ? params[1] : "";
- if (!(ci = cs_findchan(chan)))
+ if (!(ci = cs_findchan(chan.c_str())))
{
- notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan);
+ notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan.c_str());
return MOD_CONT;
}
else if (readonly)
@@ -59,25 +59,25 @@ class CommandMSDel : public Command
{
mi = &u->nc->memos;
}
- if (!numstr || (!isdigit(*numstr) && stricmp(numstr, "ALL") && stricmp(numstr, "LAST")))
+ if (numstr.empty() || (!isdigit(numstr[0]) && numstr != "ALL" && numstr != "LAST"))
this->OnSyntaxError(u);
else if (mi->memos.empty())
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_MEMOS);
}
else
{
- if (isdigit(*numstr))
+ if (isdigit(numstr[0]))
{
/* Delete a specific memo or memos. */
last = -1; /* Last memo deleted */
last0 = -1; /* Beginning of range of last memos deleted */
end = buf;
left = sizeof(buf);
- delcount = process_numlist(numstr, &count, del_memo_callback, u, mi, &last, &last0, &end, &left);
+ delcount = process_numlist(numstr.c_str(), &count, del_memo_callback, u, mi, &last, &last0, &end, &left);
if (last != -1)
{
/* Some memos got deleted; tell them which ones. */
@@ -97,12 +97,12 @@ class CommandMSDel : public Command
{
/* No memos were deleted. Tell them so. */
if (count == 1)
- notice_lang(s_MemoServ, u, MEMO_DOES_NOT_EXIST, atoi(numstr));
+ notice_lang(s_MemoServ, u, MEMO_DOES_NOT_EXIST, atoi(numstr.c_str()));
else
notice_lang(s_MemoServ, u, MEMO_DELETED_NONE);
}
}
- else if (!stricmp(numstr, "LAST"))
+ else if (numstr == "LAST")
{
/* Delete last memo. */
for (i = 0; i < mi->memos.size(); ++i)
@@ -119,8 +119,8 @@ class CommandMSDel : public Command
delete mi->memos[i];
}
mi->memos.clear();
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_CHAN_DELETED_ALL, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_CHAN_DELETED_ALL, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_DELETED_ALL);
}
diff --git a/src/core/ms_help.c b/src/core/ms_help.c
index 382f571dc..b79b7f622 100644
--- a/src/core/ms_help.c
+++ b/src/core/ms_help.c
@@ -23,9 +23,9 @@ class CommandMSHelp : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- mod_help_cmd(s_MemoServ, u, MEMOSERV, params.size() > 0 ? params[0].c_str() : NULL);
+ mod_help_cmd(s_MemoServ, u, MEMOSERV, params[0].c_str());
return MOD_CONT;
}
diff --git a/src/core/ms_info.c b/src/core/ms_info.c
index a72523679..b418aa7e5 100644
--- a/src/core/ms_info.c
+++ b/src/core/ms_info.c
@@ -22,7 +22,7 @@ class CommandMSInfo : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
MemoInfo *mi;
NickAlias *na = NULL;
diff --git a/src/core/ms_list.c b/src/core/ms_list.c
index 8506f53a0..e2dfc9b28 100644
--- a/src/core/ms_list.c
+++ b/src/core/ms_list.c
@@ -25,22 +25,21 @@ class CommandMSList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *param = params.size() ? params[0].c_str() : NULL, *chan = NULL;
+ ci::string param = params.size() ? params[0] : "", chan;
ChannelInfo *ci;
MemoInfo *mi;
- Memo *m;
int i;
- if (param && *param == '#')
+ if (!param.empty() && param[0] == '#')
{
chan = param;
- param = params.size() > 1 ? params[1].c_str() : NULL;
+ param = params.size() > 1 ? params[1] : "";
- if (!(ci = cs_findchan(chan)))
+ if (!(ci = cs_findchan(chan.c_str())))
{
- notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan);
+ notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan.c_str());
return MOD_CONT;
}
else if (!check_access(u, ci, CA_MEMO))
@@ -54,24 +53,23 @@ class CommandMSList : public Command
{
mi = &u->nc->memos;
}
- if (param && !isdigit(*param) && stricmp(param, "NEW"))
+ if (!param.empty() && !isdigit(param[0]) && param != "NEW")
this->OnSyntaxError(u);
else if (!mi->memos.size())
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_MEMOS);
}
else
{
int sent_header = 0;
- if (param && isdigit(*param))
- process_numlist(param, NULL, list_memo_callback, u,
- mi, &sent_header, chan);
+ if (!param.empty() && isdigit(param[0]))
+ process_numlist(param.c_str(), NULL, list_memo_callback, u, mi, &sent_header, chan.c_str());
else
{
- if (param)
+ if (!param.empty())
{
for (i = 0; i < mi->memos.size(); ++i)
{
@@ -80,8 +78,8 @@ class CommandMSList : public Command
}
if (i == mi->memos.size())
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_NEW_MEMOS);
return MOD_CONT;
@@ -89,9 +87,9 @@ class CommandMSList : public Command
}
for (i = 0; i < mi->memos.size(); ++i)
{
- if (param && !(mi->memos[i]->flags & MF_UNREAD))
+ if (!param.empty() && !(mi->memos[i]->flags & MF_UNREAD))
continue;
- list_memo(u, i, mi, &sent_header, param != NULL, chan);
+ list_memo(u, i, mi, &sent_header, !param.empty(), chan.c_str());
}
}
}
diff --git a/src/core/ms_read.c b/src/core/ms_read.c
index 4335565da..a0d13ea95 100644
--- a/src/core/ms_read.c
+++ b/src/core/ms_read.c
@@ -26,21 +26,21 @@ class CommandMSRead : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
MemoInfo *mi;
ChannelInfo *ci;
- const char *numstr = params.size() ? params[0].c_str() : NULL, *chan = NULL;
+ ci::string numstr = params.size() ? params[0] : "", chan;
int num, count;
- if (numstr && *numstr == '#')
+ if (!numstr.empty() && numstr[0] == '#')
{
chan = numstr;
- numstr = params.size() > 1 ? params[1].c_str() : NULL;
+ numstr = params.size() > 1 ? params[1] : "";
- if (!(ci = cs_findchan(chan)))
+ if (!(ci = cs_findchan(chan.c_str())))
{
- notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan);
+ notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan.c_str());
return MOD_CONT;
}
else if (!check_access(u, ci, CA_MEMO))
@@ -54,51 +54,51 @@ class CommandMSRead : public Command
{
mi = &u->nc->memos;
}
- num = numstr ? atoi(numstr) : -1;
- if (!numstr || (stricmp(numstr, "LAST") && stricmp(numstr, "NEW") && num <= 0))
+ num = !numstr.empty() ? atoi(numstr.c_str()) : -1;
+ if (numstr.empty() || (numstr != "LAST" && numstr != "NEW" && num <= 0))
this->OnSyntaxError(u);
else if (mi->memos.empty())
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_MEMOS, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_MEMOS);
}
else {
int i;
- if (!stricmp(numstr, "NEW"))
+ if (numstr == "NEW")
{
int readcount = 0;
for (i = 0; i < mi->memos.size(); ++i)
{
if (mi->memos[i]->flags & MF_UNREAD)
{
- read_memo(u, i, mi, chan);
+ read_memo(u, i, mi, chan.c_str());
++readcount;
}
}
if (!readcount)
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str());
else
notice_lang(s_MemoServ, u, MEMO_HAVE_NO_NEW_MEMOS);
}
}
- else if (!stricmp(numstr, "LAST"))
+ else if (numstr == "LAST")
{
for (i = 0; i < mi->memos.size() - 1; ++i);
- read_memo(u, i, mi, chan);
+ read_memo(u, i, mi, chan.c_str());
}
else /* number[s] */
{
- if (!process_numlist(numstr, &count, read_memo_callback, u, mi, chan))
+ if (!process_numlist(numstr.c_str(), &count, read_memo_callback, u, mi, chan.c_str()))
{
if (count == 1)
notice_lang(s_MemoServ, u, MEMO_DOES_NOT_EXIST, num);
else
- notice_lang(s_MemoServ, u, MEMO_LIST_NOT_FOUND, numstr);
+ notice_lang(s_MemoServ, u, MEMO_LIST_NOT_FOUND, numstr.c_str());
}
}
}
diff --git a/src/core/ms_rsend.c b/src/core/ms_rsend.c
index afec57bbc..78f49803f 100644
--- a/src/core/ms_rsend.c
+++ b/src/core/ms_rsend.c
@@ -22,7 +22,7 @@ class CommandMSRSend : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *text = params[1].c_str();
diff --git a/src/core/ms_send.c b/src/core/ms_send.c
index edb919fa5..04c329878 100644
--- a/src/core/ms_send.c
+++ b/src/core/ms_send.c
@@ -22,7 +22,7 @@ class CommandMSSend : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *text = params[1].c_str();
diff --git a/src/core/ms_sendall.c b/src/core/ms_sendall.c
index 40deef419..aab1d71c2 100644
--- a/src/core/ms_sendall.c
+++ b/src/core/ms_sendall.c
@@ -22,7 +22,7 @@ class CommandMSSendAll : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
int i, z = 1;
NickCore *nc;
diff --git a/src/core/ms_set.c b/src/core/ms_set.c
index 48d871ed3..a149bb26a 100644
--- a/src/core/ms_set.c
+++ b/src/core/ms_set.c
@@ -18,28 +18,28 @@
class CommandMSSet : public Command
{
private:
- CommandReturn DoNotify(User *u, std::vector<std::string> &params, MemoInfo *mi)
+ CommandReturn DoNotify(User *u, std::vector<ci::string> &params, MemoInfo *mi)
{
- const char *param = params[1].c_str();
+ ci::string param = params[1];
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
u->nc->flags |= NI_MEMO_SIGNON | NI_MEMO_RECEIVE;
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_ON, s_MemoServ);
}
- else if (!stricmp(param, "LOGON"))
+ else if (param == "LOGON")
{
u->nc->flags |= NI_MEMO_SIGNON;
u->nc->flags &= ~NI_MEMO_RECEIVE;
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_LOGON, s_MemoServ);
}
- else if (!stricmp(param, "NEW"))
+ else if (param == "NEW")
{
u->nc->flags &= ~NI_MEMO_SIGNON;
u->nc->flags |= NI_MEMO_RECEIVE;
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_NEW, s_MemoServ);
}
- else if (!stricmp(param, "MAIL"))
+ else if (param == "MAIL")
{
if (u->nc->email)
{
@@ -49,12 +49,12 @@ class CommandMSSet : public Command
else
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_INVALIDMAIL);
}
- else if (!stricmp(param, "NOMAIL"))
+ else if (param == "NOMAIL")
{
u->nc->flags &= ~NI_MEMO_MAIL;
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_NOMAIL);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
u->nc->flags &= ~(NI_MEMO_SIGNON | NI_MEMO_RECEIVE | NI_MEMO_MAIL);
notice_lang(s_MemoServ, u, MEMO_SET_NOTIFY_OFF, s_MemoServ);
@@ -64,26 +64,26 @@ class CommandMSSet : public Command
return MOD_CONT;
}
- CommandReturn DoLimit(User *u, std::vector<std::string> &params, MemoInfo *mi)
+ CommandReturn DoLimit(User *u, std::vector<ci::string> &params, MemoInfo *mi)
{
- const char *p1 = params[1].c_str();
- const char *p2 = params.size() > 2 ? params[2].c_str() : NULL;
- const char *p3 = params.size() > 3 ? params[3].c_str() : NULL;
- const char *user = NULL, *chan = NULL;
+ ci::string p1 = params[1];
+ ci::string p2 = params.size() > 2 ? params[2] : "";
+ ci::string p3 = params.size() > 3 ? params[3] : "";
+ ci::string user, chan;
int32 limit;
NickCore *nc = u->nc;
ChannelInfo *ci = NULL;
bool is_servadmin = u->nc->HasPriv("memoserv/set-limit");
- if (*p1 == '#')
+ if (p1[0] == '#')
{
chan = p1;
p1 = p2;
p2 = p3;
- p3 = params.size() > 4 ? params[4].c_str() : NULL;
- if (!(ci = cs_findchan(chan)))
+ p3 = params.size() > 4 ? params[4] : "";
+ if (!(ci = cs_findchan(chan.c_str())))
{
- notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan);
+ notice_lang(s_MemoServ, u, CHAN_X_NOT_REGISTERED, chan.c_str());
return MOD_CONT;
}
else if (!is_servadmin && !check_access(u, ci, CA_MEMO))
@@ -95,12 +95,12 @@ class CommandMSSet : public Command
}
if (is_servadmin)
{
- if (p2 && stricmp(p2, "HARD") && !chan)
+ if (!p2.empty() && p2 != "HARD" && chan.empty())
{
NickAlias *na;
- if (!(na = findnick(p1)))
+ if (!(na = findnick(p1.c_str())))
{
- notice_lang(s_MemoServ, u, NICK_X_NOT_REGISTERED, p1);
+ notice_lang(s_MemoServ, u, NICK_X_NOT_REGISTERED, p1.c_str());
return MOD_CONT;
}
user = p1;
@@ -109,61 +109,62 @@ class CommandMSSet : public Command
p1 = p2;
p2 = p3;
}
- else if (!p1)
+ else if (p1.empty())
{
syntax_error(s_MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX);
return MOD_CONT;
}
- if ((!isdigit(*p1) && stricmp(p1, "NONE")) || (p2 && stricmp(p2, "HARD")))
+ if ((!isdigit(p1[0]) && p1 != "NONE") || (!p2.empty() && p2 != "HARD"))
{
syntax_error(s_MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SERVADMIN_SYNTAX);
return MOD_CONT;
}
- if (chan)
+ if (!chan.empty())
{
- if (p2)
+ if (!p2.empty())
ci->flags |= CI_MEMO_HARDMAX;
else
ci->flags &= ~CI_MEMO_HARDMAX;
}
else
{
- if (p2)
+ if (!p2.empty())
nc->flags |= NI_MEMO_HARDMAX;
else
nc->flags &= ~NI_MEMO_HARDMAX;
}
- limit = atoi(p1);
+ limit = atoi(p1.c_str());
if (limit < 0 || limit > 32767)
{
notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_OVERFLOW, 32767);
limit = 32767;
}
- if (stricmp(p1, "NONE") == 0)
+ if (p1 == "NONE")
limit = -1;
}
else
{
- if (!p1 || p2 || !isdigit(*p1)) {
+ if (p1.empty() || !p2.empty() || !isdigit(p1[0])) {
syntax_error(s_MemoServ, u, "SET LIMIT", MEMO_SET_LIMIT_SYNTAX);
return MOD_CONT;
}
- if (chan && (ci->flags & CI_MEMO_HARDMAX))
+ if (!chan.empty() && (ci->flags & CI_MEMO_HARDMAX))
{
- notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_FORBIDDEN, chan);
+ notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_FORBIDDEN, chan.c_str());
return MOD_CONT;
}
- else if (!chan && (nc->flags & NI_MEMO_HARDMAX)) {
+ else if (chan.empty() && (nc->flags & NI_MEMO_HARDMAX))
+ {
notice_lang(s_MemoServ, u, MEMO_SET_YOUR_LIMIT_FORBIDDEN);
return MOD_CONT;
}
- limit = atoi(p1);
+ limit = atoi(p1.c_str());
/* The first character is a digit, but we could still go negative
* from overflow... watch out! */
if (limit < 0 || (MSMaxMemos > 0 && limit > MSMaxMemos))
{
- if (chan)
- notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_TOO_HIGH, chan, MSMaxMemos);
+ if (!chan.empty())
+ notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_TOO_HIGH, chan.c_str(), MSMaxMemos);
else
notice_lang(s_MemoServ, u, MEMO_SET_YOUR_LIMIT_TOO_HIGH, MSMaxMemos);
return MOD_CONT;
@@ -177,25 +178,24 @@ class CommandMSSet : public Command
mi->memomax = limit;
if (limit > 0)
{
- if (!chan && nc == u->nc)
+ if (chan.empty() && nc == u->nc)
notice_lang(s_MemoServ, u, MEMO_SET_YOUR_LIMIT, limit);
else
- notice_lang(s_MemoServ, u, MEMO_SET_LIMIT, chan ? chan : user, limit);
+ notice_lang(s_MemoServ, u, MEMO_SET_LIMIT, !chan.empty() ? chan.c_str() : user.c_str(), limit);
}
else if (!limit)
{
- if (!chan && nc == u->nc)
+ if (chan.empty() && nc == u->nc)
notice_lang(s_MemoServ, u, MEMO_SET_YOUR_LIMIT_ZERO);
else
- notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_ZERO, chan ? chan : user);
+ notice_lang(s_MemoServ, u, MEMO_SET_LIMIT_ZERO, !chan.empty() ? chan.c_str() : user.c_str());
}
else
{
- if (!chan && nc == u->nc)
+ if (chan.empty() && nc == u->nc)
notice_lang(s_MemoServ, u, MEMO_UNSET_YOUR_LIMIT);
else
- notice_lang(s_MemoServ, u, MEMO_UNSET_LIMIT,
- chan ? chan : user);
+ notice_lang(s_MemoServ, u, MEMO_UNSET_LIMIT, !chan.empty() ? chan.c_str() : user.c_str());
}
return MOD_CONT;
}
@@ -204,9 +204,9 @@ class CommandMSSet : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
MemoInfo *mi = &u->nc->memos;
if (readonly)
@@ -214,14 +214,13 @@ class CommandMSSet : public Command
notice_lang(s_MemoServ, u, MEMO_SET_DISABLED);
return MOD_CONT;
}
- else if (!stricmp(cmd, "NOTIFY"))
+ else if (cmd == "NOTIFY")
return this->DoNotify(u, params, mi);
- else if (!stricmp(cmd, "LIMIT")) {
+ else if (cmd == "LIMIT")
return this->DoLimit(u, params, mi);
- }
else
{
- notice_lang(s_MemoServ, u, MEMO_SET_UNKNOWN_OPTION, cmd);
+ notice_lang(s_MemoServ, u, MEMO_SET_UNKNOWN_OPTION, cmd.c_str());
notice_lang(s_MemoServ, u, MORE_INFO, s_MemoServ, "SET");
}
return MOD_CONT;
diff --git a/src/core/ms_staff.c b/src/core/ms_staff.c
index 61a6483d8..6000c3205 100644
--- a/src/core/ms_staff.c
+++ b/src/core/ms_staff.c
@@ -22,7 +22,7 @@ class CommandMSStaff : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickCore *nc;
int i, z = 0;
diff --git a/src/core/ns_access.c b/src/core/ns_access.c
index c03b982fc..82e05ad34 100644
--- a/src/core/ns_access.c
+++ b/src/core/ns_access.c
@@ -18,7 +18,7 @@
class CommandNSAccess : public Command
{
private:
- CommandReturn DoServAdminList(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoServAdminList(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *mask = params.size() > 2 ? params[2].c_str() : NULL;
unsigned i;
@@ -55,7 +55,7 @@ class CommandNSAccess : public Command
return MOD_CONT;
}
- CommandReturn DoAdd(User *u, std::vector<std::string> &params, NickCore *nc, const char *mask)
+ CommandReturn DoAdd(User *u, NickCore *nc, const char *mask)
{
if (!mask)
{
@@ -81,7 +81,7 @@ class CommandNSAccess : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params, NickCore *nc, const char *mask)
+ CommandReturn DoDel(User *u, NickCore *nc, const char *mask)
{
if (!mask)
{
@@ -101,7 +101,7 @@ class CommandNSAccess : public Command
return MOD_CONT;
}
- CommandReturn DoList(User *u, std::vector<std::string> &params, NickCore *nc, const char *mask)
+ CommandReturn DoList(User *u, NickCore *nc, const char *mask)
{
unsigned i;
@@ -127,13 +127,13 @@ class CommandNSAccess : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
const char *mask = params.size() > 1 ? params[1].c_str() : NULL;
NickAlias *na;
- if (!stricmp(cmd, "LIST") && u->nc->IsServicesOper() && mask && (na = findnick(params[1].c_str())))
+ if (cmd == "LIST" && u->nc->IsServicesOper() && mask && (na = findnick(params[1].c_str())))
return this->DoServAdminList(u, params, na->nc);
if (mask && !strchr(mask, '@'))
@@ -148,12 +148,12 @@ class CommandNSAccess : public Command
*/
else if (u->nc->flags & NI_SUSPENDED)
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, u->nc->display);
- else if (!stricmp(cmd, "ADD"))
- return this->DoAdd(u, params, u->nc, mask);
- else if (!stricmp(cmd, "DEL"))
- return this->DoDel(u, params, u->nc, mask);
- else if (!stricmp(cmd, "LIST"))
- return this->DoList(u, params, u->nc, mask);
+ else if (cmd == "ADD")
+ return this->DoAdd(u, u->nc, mask);
+ else if (cmd == "DEL")
+ return this->DoDel(u, u->nc, mask);
+ else if (cmd == "LIST")
+ return this->DoList(u, u->nc, mask);
else
this->OnSyntaxError(u);
return MOD_CONT;
diff --git a/src/core/ns_alist.c b/src/core/ns_alist.c
index e97a4f61d..c4bfa04c7 100644
--- a/src/core/ns_alist.c
+++ b/src/core/ns_alist.c
@@ -22,7 +22,7 @@ class CommandNSAList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
/*
* List the channels that the given nickname has access on
@@ -34,7 +34,6 @@ class CommandNSAList : public Command
*/
const char *nick = NULL;
- const char *lev = NULL;
NickAlias *na;
@@ -63,22 +62,23 @@ class CommandNSAList : public Command
}
/* If available, get level from arguments */
- lev = params.size() > lev_param ? params[lev_param].c_str() : NULL;
+ ci::string lev = params.size() > lev_param ? params[lev_param] : "";
/* if a level was given, make sure it's an int for later */
- if (lev) {
- if (!stricmp(lev, "FOUNDER"))
+ if (!lev.empty())
+ {
+ if (lev == "FOUNDER")
min_level = ACCESS_FOUNDER;
- else if (!stricmp(lev, "SOP"))
+ else if (lev == "SOP")
min_level = ACCESS_SOP;
- else if (!stricmp(lev, "AOP"))
+ else if (lev == "AOP")
min_level = ACCESS_AOP;
- else if (!stricmp(lev, "HOP"))
+ else if (lev == "HOP")
min_level = ACCESS_HOP;
- else if (!stricmp(lev, "VOP"))
+ else if (lev == "VOP")
min_level = ACCESS_VOP;
else
- min_level = atoi(lev);
+ min_level = atoi(lev.c_str());
}
if (!na)
diff --git a/src/core/ns_drop.c b/src/core/ns_drop.c
index f79b1168d..8bd7d6c18 100644
--- a/src/core/ns_drop.c
+++ b/src/core/ns_drop.c
@@ -22,7 +22,7 @@ class CommandNSDrop : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params.size() ? params[0].c_str() : NULL;
NickAlias *na;
diff --git a/src/core/ns_forbid.c b/src/core/ns_forbid.c
index 85b551275..ace11292f 100644
--- a/src/core/ns_forbid.c
+++ b/src/core/ns_forbid.c
@@ -24,7 +24,7 @@ class CommandNSForbid : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na;
const char *nick = params[0].c_str();
diff --git a/src/core/ns_getemail.c b/src/core/ns_getemail.c
index 618600325..4dde78f8b 100644
--- a/src/core/ns_getemail.c
+++ b/src/core/ns_getemail.c
@@ -27,30 +27,30 @@ class CommandNSGetEMail : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *email = params[0].c_str();
+ ci::string email = params[0];
int i, j = 0;
NickCore *nc;
- alog("%s: %s!%s@%s used GETEMAIL on %s", s_NickServ, u->nick, u->GetIdent().c_str(), u->host, email);
+ alog("%s: %s!%s@%s used GETEMAIL on %s", s_NickServ, u->nick, u->GetIdent().c_str(), u->host, email.c_str());
for (i = 0; i < 1024; ++i)
{
for (nc = nclists[i]; nc; nc = nc->next)
{
if (nc->email)
{
- if (!stricmp(nc->email, email))
+ if (nc->email == email)
{
++j;
- notice_lang(s_NickServ, u, NICK_GETEMAIL_EMAILS_ARE, nc->display, email);
+ notice_lang(s_NickServ, u, NICK_GETEMAIL_EMAILS_ARE, nc->display, email.c_str());
}
}
}
}
if (j <= 0)
{
- notice_lang(s_NickServ, u, NICK_GETEMAIL_NOT_USED, email);
+ notice_lang(s_NickServ, u, NICK_GETEMAIL_NOT_USED, email.c_str());
return MOD_CONT;
}
return MOD_CONT;
diff --git a/src/core/ns_getpass.c b/src/core/ns_getpass.c
index 0e4057b0f..242d63352 100644
--- a/src/core/ns_getpass.c
+++ b/src/core/ns_getpass.c
@@ -22,7 +22,7 @@ class CommandNSGetPass : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
char tmp_pass[PASSMAX];
diff --git a/src/core/ns_ghost.c b/src/core/ns_ghost.c
index f1f0cafe1..8546569f4 100644
--- a/src/core/ns_ghost.c
+++ b/src/core/ns_ghost.c
@@ -23,7 +23,7 @@ class CommandNSGhost : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *pass = params.size() > 1 ? params[1].c_str() : NULL;
diff --git a/src/core/ns_group.c b/src/core/ns_group.c
index d5bd16770..3a3b68777 100644
--- a/src/core/ns_group.c
+++ b/src/core/ns_group.c
@@ -25,7 +25,7 @@ class CommandNSGroup : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na, *target;
NickCore *nc;
@@ -177,7 +177,7 @@ class CommandNSGList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params.size() ? params[0].c_str() : NULL;
diff --git a/src/core/ns_help.c b/src/core/ns_help.c
index 046af753f..dc6db0814 100644
--- a/src/core/ns_help.c
+++ b/src/core/ns_help.c
@@ -23,11 +23,11 @@ class CommandNSHelp : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!stricmp(cmd, "SET LANGUAGE"))
+ if (cmd == "SET LANGUAGE")
{
int i;
notice_help(s_NickServ, u, NICK_HELP_SET_LANGUAGE);
@@ -35,7 +35,7 @@ class CommandNSHelp : public Command
u->SendMessage(s_NickServ, " %2d) %s", i + 1, langnames[langlist[i]]);
}
else
- mod_help_cmd(s_NickServ, u, NICKSERV, cmd);
+ mod_help_cmd(s_NickServ, u, NICKSERV, cmd.c_str());
return MOD_CONT;
}
diff --git a/src/core/ns_identify.c b/src/core/ns_identify.c
index 30fd7a906..e2bacf321 100644
--- a/src/core/ns_identify.c
+++ b/src/core/ns_identify.c
@@ -26,7 +26,7 @@ class CommandNSIdentify : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *pass = params[0].c_str();
NickAlias *na;
diff --git a/src/core/ns_info.c b/src/core/ns_info.c
index 83242de89..cfcfc4299 100644
--- a/src/core/ns_info.c
+++ b/src/core/ns_info.c
@@ -36,7 +36,7 @@ class CommandNSInfo : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
/* Show hidden info to nick owners and sadmins when the "ALL" parameter is
* supplied. If a nick is online, the "Last seen address" changes to "Is
@@ -45,7 +45,7 @@ class CommandNSInfo : public Command
* -TheShadow (13 Mar 1999)
*/
const char *nick = params[0].c_str();
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
NickAlias *na;
NickRequest *nr = NULL;
@@ -56,7 +56,7 @@ class CommandNSInfo : public Command
if ((nr = findrequestnick(nick)))
{
notice_lang(s_NickServ, u, NICK_IS_PREREG);
- if (param && !stricmp(param, "ALL") && u->nc && u->nc->IsServicesOper())
+ if (!param.empty() && param == "ALL" && u->nc && u->nc->IsServicesOper())
notice_lang(s_NickServ, u, NICK_INFO_EMAIL, nr->email);
else
{
@@ -90,7 +90,7 @@ class CommandNSInfo : public Command
/* Only show hidden fields to owner and sadmins and only when the ALL
* parameter is used. -TheShadow */
- if (param && !stricmp(param, "ALL") && u->nc && (na->nc == u->nc || u->nc->IsServicesOper()))
+ if (!param.empty() && param == "ALL" && u->nc && (na->nc == u->nc || u->nc->IsServicesOper()))
show_hidden = 1;
notice_lang(s_NickServ, u, NICK_INFO_REALNAME, na->nick, na->last_realname);
diff --git a/src/core/ns_list.c b/src/core/ns_list.c
index b9db35576..82c72c149 100644
--- a/src/core/ns_list.c
+++ b/src/core/ns_list.c
@@ -23,7 +23,7 @@ class CommandNSList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
/* SADMINS can search for nicks based on their NS_FORBIDDEN and NS_NO_EXPIRE
* status. The keywords FORBIDDEN and NOEXPIRE represent these two states
@@ -104,16 +104,17 @@ class CommandNSList : public Command
if (is_servadmin && params.size() > 1)
{
std::string keyword;
- spacesepstream keywords(params[1]);
+ spacesepstream keywords(params[1].c_str());
while (keywords.GetToken(keyword))
{
- if (!stricmp(keyword.c_str(), "FORBIDDEN"))
+ ci::string keyword_ci = keyword.c_str();
+ if (keyword_ci == "FORBIDDEN")
matchflags |= NS_FORBIDDEN;
- if (!stricmp(keyword.c_str(), "NOEXPIRE"))
+ if (keyword_ci == "NOEXPIRE")
matchflags |= NS_NO_EXPIRE;
- if (!stricmp(keyword.c_str(), "SUSPENDED"))
+ if (keyword_ci == "SUSPENDED")
susp_keyword = 1;
- if (!stricmp(keyword.c_str(), "UNCONFIRMED"))
+ if (keyword_ci == "UNCONFIRMED")
nronly = 1;
}
}
diff --git a/src/core/ns_logout.c b/src/core/ns_logout.c
index a7652b1e6..6a7a6e337 100644
--- a/src/core/ns_logout.c
+++ b/src/core/ns_logout.c
@@ -25,10 +25,10 @@ class CommandNSLogout : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params.size() ? params[0].c_str() : NULL;
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
User *u2;
NickAlias *na;
struct u_chaninfolist *ci, *ci2;
@@ -48,7 +48,7 @@ class CommandNSLogout : public Command
notice_lang(s_NickServ, u, NICK_LOGOUT_SERVICESADMIN, nick);
else
{
- if (nick && param && !stricmp(param, "REVALIDATE"))
+ if (nick && !param.empty() && param == "REVALIDATE")
{
cancel_user(u2);
validate_user(u2);
diff --git a/src/core/ns_recover.c b/src/core/ns_recover.c
index 0b851cdc8..d92f0292e 100644
--- a/src/core/ns_recover.c
+++ b/src/core/ns_recover.c
@@ -23,7 +23,7 @@ class CommandNSRecover : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *pass = params.size() > 1 ? params[1].c_str() : NULL;
diff --git a/src/core/ns_register.c b/src/core/ns_register.c
index 6bee5b809..6c7f7af3c 100644
--- a/src/core/ns_register.c
+++ b/src/core/ns_register.c
@@ -106,7 +106,7 @@ class CommandNSConfirm : public Command
}
- CommandReturn DoConfirm(User *u, std::vector<std::string> &params)
+ CommandReturn DoConfirm(User *u, std::vector<ci::string> &params)
{
NickRequest *nr = NULL;
const char *passcode = params.size() ? params[0].c_str() : NULL;
@@ -178,7 +178,7 @@ class CommandNSConfirm : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoConfirm(u, params);
}
@@ -198,7 +198,7 @@ class CommandNSRegister : public CommandNSConfirm
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickRequest *nr = NULL, *anr = NULL;
NickAlias *na;
@@ -323,7 +323,7 @@ class CommandNSRegister : public CommandNSConfirm
}
else
{
- std::vector<std::string> empty_params;
+ std::vector<ci::string> empty_params;
return this->DoConfirm(u, empty_params);
}
}
@@ -354,7 +354,7 @@ class CommandNSResend : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickRequest *nr = NULL;
if (NSEmailReg)
diff --git a/src/core/ns_release.c b/src/core/ns_release.c
index 4da37a662..760277fe3 100644
--- a/src/core/ns_release.c
+++ b/src/core/ns_release.c
@@ -23,7 +23,7 @@ class CommandNSRelease : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *pass = params.size() > 1 ? params[1].c_str() : NULL;
diff --git a/src/core/ns_saset.c b/src/core/ns_saset.c
index 4be6b3af9..00fc6986d 100644
--- a/src/core/ns_saset.c
+++ b/src/core/ns_saset.c
@@ -18,13 +18,13 @@
class CommandNSSASet : public Command
{
private:
- CommandReturn DoSetDisplay(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetDisplay(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
int i;
NickAlias *na;
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -34,7 +34,7 @@ private:
for (i = 0; i < nc->aliases.count; ++i)
{
na = static_cast<NickAlias *>(nc->aliases.list[i]);
- if (!stricmp(na->nick, param))
+ if (na->nick == param)
{
param = na->nick; /* Because case may differ */
break;
@@ -47,22 +47,22 @@ private:
return MOD_CONT;
}
- change_core_display(nc, param);
+ change_core_display(nc, param.c_str());
notice_lang(s_NickServ, u, NICK_SASET_DISPLAY_CHANGED, nc->display);
return MOD_CONT;
}
- CommandReturn DoSetPassword(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetPassword(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- int len = strlen(param);
+ int len = param.size();
char tmp_pass[PASSMAX];
if (NSSecureAdmins && u->nc != nc && nc->IsServicesOper())
@@ -70,7 +70,7 @@ private:
notice_lang(s_NickServ, u, ACCESS_DENIED);
return MOD_CONT;
}
- else if (!stricmp(nc->display, param) || (StrictPasswords && len < 5))
+ else if (nc->display == param || (StrictPasswords && len < 5))
{
notice_lang(s_NickServ, u, MORE_OBSCURE_PASSWORD);
return MOD_CONT;
@@ -81,7 +81,7 @@ private:
return MOD_CONT;
}
- if (enc_encrypt(param, len, nc->pass, PASSMAX - 1) < 0)
+ if (enc_encrypt(param.c_str(), len, nc->pass, PASSMAX - 1) < 0)
{
params[2].clear();
alog("%s: Failed to encrypt password for %s (set)", s_NickServ, nc->display);
@@ -101,7 +101,7 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetUrl(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetUrl(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 2 ? params[2].c_str() : NULL;
@@ -121,7 +121,7 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetEmail(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetEmail(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 2 ? params[2].c_str() : NULL;
@@ -159,7 +159,7 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetICQ(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetICQ(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 2 ? params[2].c_str() : NULL;
@@ -171,8 +171,7 @@ private:
else
{
nc->icq = tmp;
- notice_lang(s_NickServ, u, NICK_SASET_ICQ_CHANGED, nc->display,
- param);
+ notice_lang(s_NickServ, u, NICK_SASET_ICQ_CHANGED, nc->display, param);
}
}
else
@@ -183,7 +182,7 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetGreet(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetGreet(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 2 ? params[2].c_str() : NULL;
@@ -208,29 +207,29 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetKill(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetKill(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_KILLPROTECT;
nc->flags &= ~(NI_KILL_QUICK | NI_KILL_IMMED);
notice_lang(s_NickServ, u, NICK_SASET_KILL_ON, nc->display);
}
- else if (!stricmp(param, "QUICK"))
+ else if (param == "QUICK")
{
nc->flags |= NI_KILLPROTECT | NI_KILL_QUICK;
nc->flags &= ~NI_KILL_IMMED;
notice_lang(s_NickServ, u, NICK_SASET_KILL_QUICK, nc->display);
}
- else if (!stricmp(param, "IMMED"))
+ else if (param == "IMMED")
{
if (NSAllowKillImmed)
{
@@ -241,7 +240,7 @@ private:
else
notice_lang(s_NickServ, u, NICK_SASET_KILL_IMMED_DISABLED);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~(NI_KILLPROTECT | NI_KILL_QUICK | NI_KILL_IMMED);
notice_lang(s_NickServ, u, NICK_SASET_KILL_OFF, nc->display);
@@ -251,22 +250,22 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetSecure(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetSecure(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_SECURE;
notice_lang(s_NickServ, u, NICK_SASET_SECURE_ON, nc->display);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~NI_SECURE;
notice_lang(s_NickServ, u, NICK_SASET_SECURE_OFF, nc->display);
@@ -276,22 +275,22 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetPrivate(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetPrivate(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_PRIVATE;
notice_lang(s_NickServ, u, NICK_SASET_PRIVATE_ON, nc->display);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~NI_PRIVATE;
notice_lang(s_NickServ, u, NICK_SASET_PRIVATE_OFF, nc->display);
@@ -301,11 +300,11 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetMsg(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetMsg(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -317,12 +316,12 @@ private:
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_MSG;
notice_lang(s_NickServ, u, NICK_SASET_MSG_ON, nc->display);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~NI_MSG;
notice_lang(s_NickServ, u, NICK_SASET_MSG_OFF, nc->display);
@@ -332,11 +331,11 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetHide(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetHide(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -344,25 +343,25 @@ private:
int flag, onmsg, offmsg;
- if (!stricmp(param, "EMAIL"))
+ if (param == "EMAIL")
{
flag = NI_HIDE_EMAIL;
onmsg = NICK_SASET_HIDE_EMAIL_ON;
offmsg = NICK_SASET_HIDE_EMAIL_OFF;
}
- else if (!stricmp(param, "USERMASK"))
+ else if (param == "USERMASK")
{
flag = NI_HIDE_MASK;
onmsg = NICK_SASET_HIDE_MASK_ON;
offmsg = NICK_SASET_HIDE_MASK_OFF;
}
- else if (!stricmp(param, "STATUS"))
+ else if (param == "STATUS")
{
flag = NI_HIDE_STATUS;
onmsg = NICK_SASET_HIDE_STATUS_ON;
offmsg = NICK_SASET_HIDE_STATUS_OFF;
}
- else if (!stricmp(param, "QUIT"))
+ else if (param == "QUIT")
{
flag = NI_HIDE_QUIT;
onmsg = NICK_SASET_HIDE_QUIT_ON;
@@ -374,15 +373,15 @@ private:
return MOD_CONT;
}
- param = params.size() > 3 ? params[3].c_str() : NULL;
- if (!param)
+ param = params.size() > 3 ? params[3] : "";
+ if (param.empty())
syntax_error(s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX);
- else if (!stricmp(param, "ON"))
+ else if (param == "ON")
{
nc->flags |= flag;
notice_lang(s_NickServ, u, onmsg, nc->display, s_NickServ);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~flag;
notice_lang(s_NickServ, u, offmsg, nc->display, s_NickServ);
@@ -392,22 +391,22 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetNoExpire(User *u, std::vector<std::string> &params, NickAlias *na)
+ CommandReturn DoSetNoExpire(User *u, std::vector<ci::string> &params, NickAlias *na)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
syntax_error(s_NickServ, u, "SASET NOEXPIRE", NICK_SASET_NOEXPIRE_SYNTAX);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
na->status |= NS_NO_EXPIRE;
notice_lang(s_NickServ, u, NICK_SASET_NOEXPIRE_ON, na->nick);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
na->status &= ~NS_NO_EXPIRE;
notice_lang(s_NickServ, u, NICK_SASET_NOEXPIRE_OFF, na->nick);
@@ -417,22 +416,22 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetAutoOP(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetAutoOP(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 2 ? params[2].c_str() : NULL;
+ ci::string param = params.size() > 2 ? params[2] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags &= ~NI_AUTOOP;
notice_lang(s_NickServ, u, NICK_SASET_AUTOOP_ON, nc->display);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags |= NI_AUTOOP;
notice_lang(s_NickServ, u, NICK_SASET_AUTOOP_OFF, nc->display);
@@ -443,7 +442,7 @@ private:
return MOD_CONT;
}
- CommandReturn DoSetLanguage(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetLanguage(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 2 ? params[2].c_str() : NULL;
@@ -476,10 +475,10 @@ public:
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
NickAlias *na;
@@ -498,36 +497,36 @@ public:
notice_lang(s_NickServ, u, NICK_X_FORBIDDEN, na->nick);
else if (na->nc->flags & NI_SUSPENDED)
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, na->nick);
- else if (!stricmp(cmd, "DISPLAY"))
+ else if (cmd == "DISPLAY")
return this->DoSetDisplay(u, params, na->nc);
- else if (!stricmp(cmd, "PASSWORD"))
+ else if (cmd == "PASSWORD")
return this->DoSetPassword(u, params, na->nc);
- else if (!stricmp(cmd, "URL"))
+ else if (cmd == "URL")
return this->DoSetUrl(u, params, na->nc);
- else if (!stricmp(cmd, "EMAIL"))
+ else if (cmd == "EMAIL")
return this->DoSetEmail(u, params, na->nc);
- else if (!stricmp(cmd, "ICQ"))
+ else if (cmd == "ICQ")
return this->DoSetICQ(u, params, na->nc);
- else if (!stricmp(cmd, "GREET"))
+ else if (cmd == "GREET")
return this->DoSetGreet(u, params, na->nc);
- else if (!stricmp(cmd, "KILL"))
+ else if (cmd == "KILL")
return this->DoSetKill(u, params, na->nc);
- else if (!stricmp(cmd, "SECURE"))
+ else if (cmd == "SECURE")
return this->DoSetSecure(u, params, na->nc);
- else if (!stricmp(cmd, "PRIVATE"))
+ else if (cmd == "PRIVATE")
return this->DoSetPrivate(u, params, na->nc);
- else if (!stricmp(cmd, "MSG"))
+ else if (cmd == "MSG")
return this->DoSetMsg(u, params, na->nc);
- else if (!stricmp(cmd, "HIDE"))
+ else if (cmd == "HIDE")
return this->DoSetHide(u, params, na->nc);
- else if (!stricmp(cmd, "NOEXPIRE"))
+ else if (cmd == "NOEXPIRE")
return this->DoSetNoExpire(u, params, na);
- else if (!stricmp(cmd, "AUTOOP"))
+ else if (cmd == "AUTOOP")
return this->DoSetAutoOP(u, params, na->nc);
- else if (!stricmp(cmd, "LANGUAGE"))
+ else if (cmd == "LANGUAGE")
return this->DoSetLanguage(u, params, na->nc);
else
- notice_lang(s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd);
+ notice_lang(s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd.c_str());
return MOD_CONT;
}
diff --git a/src/core/ns_sendpass.c b/src/core/ns_sendpass.c
index fdb71b9b4..0431e68fe 100644
--- a/src/core/ns_sendpass.c
+++ b/src/core/ns_sendpass.c
@@ -22,7 +22,7 @@ class CommandNSSendPass : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
NickAlias *na;
diff --git a/src/core/ns_set.c b/src/core/ns_set.c
index 7492810a3..eee6e2587 100644
--- a/src/core/ns_set.c
+++ b/src/core/ns_set.c
@@ -18,11 +18,11 @@
class CommandNSSet : public Command
{
private:
- CommandReturn DoSetDisplay(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetDisplay(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -35,7 +35,7 @@ class CommandNSSet : public Command
for (i = 0; i < nc->aliases.count; ++i)
{
na = static_cast<NickAlias *>(nc->aliases.list[i]);
- if (!stricmp(na->nick, param))
+ if (na->nick == param)
{
param = na->nick; /* Because case may differ */
break;
@@ -48,25 +48,25 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- change_core_display(nc, param);
+ change_core_display(nc, param.c_str());
notice_lang(s_NickServ, u, NICK_SET_DISPLAY_CHANGED, nc->display);
return MOD_CONT;
}
- CommandReturn DoSetPassword(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetPassword(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- int len = strlen(param);
+ int len = param.size();
char tmp_pass[PASSMAX];
- if (!stricmp(nc->display, param) || (StrictPasswords && len < 5))
+ if (nc->display == param || (StrictPasswords && len < 5))
{
notice_lang(s_NickServ, u, MORE_OBSCURE_PASSWORD);
return MOD_CONT;
@@ -77,7 +77,7 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- if (enc_encrypt(param, len, nc->pass, PASSMAX - 1) < 0)
+ if (enc_encrypt(param.c_str(), len, nc->pass, PASSMAX - 1) < 0)
{
params[1].clear();
alog("%s: Failed to encrypt password for %s (set)", s_NickServ, nc->display);
@@ -96,7 +96,7 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetLanguage(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetLanguage(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 1 ? params[1].c_str() : NULL;
@@ -124,7 +124,7 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetUrl(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetUrl(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 1 ? params[1].c_str() : NULL;
@@ -144,7 +144,7 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetEmail(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetEmail(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 1 ? params[1].c_str() : NULL;
@@ -177,7 +177,7 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetICQ(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetICQ(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 1 ? params[1].c_str() : NULL;
@@ -200,7 +200,7 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetGreet(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetGreet(User *u, std::vector<ci::string> &params, NickCore *nc)
{
const char *param = params.size() > 1 ? params[1].c_str() : NULL;
@@ -225,29 +225,29 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetKill(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetKill(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : NULL;
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_KILLPROTECT;
nc->flags &= ~(NI_KILL_QUICK | NI_KILL_IMMED);
notice_lang(s_NickServ, u, NICK_SET_KILL_ON);
}
- else if (!stricmp(param, "QUICK"))
+ else if (param == "QUICK")
{
nc->flags |= NI_KILLPROTECT | NI_KILL_QUICK;
nc->flags &= ~NI_KILL_IMMED;
notice_lang(s_NickServ, u, NICK_SET_KILL_QUICK);
}
- else if (!stricmp(param, "IMMED"))
+ else if (param == "IMMED")
{
if (NSAllowKillImmed)
{
@@ -258,7 +258,7 @@ class CommandNSSet : public Command
else
notice_lang(s_NickServ, u, NICK_SET_KILL_IMMED_DISABLED);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~(NI_KILLPROTECT | NI_KILL_QUICK | NI_KILL_IMMED);
notice_lang(s_NickServ, u, NICK_SET_KILL_OFF);
@@ -268,22 +268,22 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetSecure(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetSecure(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_SECURE;
notice_lang(s_NickServ, u, NICK_SET_SECURE_ON);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~NI_SECURE;
notice_lang(s_NickServ, u, NICK_SET_SECURE_OFF);
@@ -293,22 +293,22 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetPrivate(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetPrivate(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_PRIVATE;
notice_lang(s_NickServ, u, NICK_SET_PRIVATE_ON);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~NI_PRIVATE;
notice_lang(s_NickServ, u, NICK_SET_PRIVATE_OFF);
@@ -318,11 +318,11 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetMsg(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetMsg(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -334,12 +334,12 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags |= NI_MSG;
notice_lang(s_NickServ, u, NICK_SET_MSG_ON);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~NI_MSG;
notice_lang(s_NickServ, u, NICK_SET_MSG_OFF);
@@ -349,11 +349,11 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetHide(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetHide(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -361,25 +361,25 @@ class CommandNSSet : public Command
int flag, onmsg, offmsg;
- if (!stricmp(param, "EMAIL"))
+ if (param == "EMAIL")
{
flag = NI_HIDE_EMAIL;
onmsg = NICK_SET_HIDE_EMAIL_ON;
offmsg = NICK_SET_HIDE_EMAIL_OFF;
}
- else if (!stricmp(param, "USERMASK"))
+ else if (param == "USERMASK")
{
flag = NI_HIDE_MASK;
onmsg = NICK_SET_HIDE_MASK_ON;
offmsg = NICK_SET_HIDE_MASK_OFF;
}
- else if (!stricmp(param, "STATUS"))
+ else if (param == "STATUS")
{
flag = NI_HIDE_STATUS;
onmsg = NICK_SET_HIDE_STATUS_ON;
offmsg = NICK_SET_HIDE_STATUS_OFF;
}
- else if (!stricmp(param, "QUIT"))
+ else if (param == "QUIT")
{
flag = NI_HIDE_QUIT;
onmsg = NICK_SET_HIDE_QUIT_ON;
@@ -391,15 +391,15 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- param = params.size() > 2 ? params[2].c_str() : NULL;
- if (!param)
+ param = params.size() > 2 ? params[2] : "";
+ if (param.empty())
syntax_error(s_NickServ, u, "SET HIDE", NICK_SET_HIDE_SYNTAX);
- else if (!stricmp(param, "ON"))
+ else if (param == "ON")
{
nc->flags |= flag;
notice_lang(s_NickServ, u, onmsg, s_NickServ);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags &= ~flag;
notice_lang(s_NickServ, u, offmsg, s_NickServ);
@@ -409,11 +409,11 @@ class CommandNSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetAutoOP(User *u, std::vector<std::string> &params, NickCore *nc)
+ CommandReturn DoSetAutoOP(User *u, std::vector<ci::string> &params, NickCore *nc)
{
- const char *param = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string param = params.size() > 1 ? params[1] : "";
- if (!param)
+ if (param.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -424,12 +424,12 @@ class CommandNSSet : public Command
* This is so when people upgrade, and dont have the flag
* the default is on
**/
- if (!stricmp(param, "ON"))
+ if (param == "ON")
{
nc->flags &= ~NI_AUTOOP;
notice_lang(s_NickServ, u, NICK_SET_AUTOOP_ON);
}
- else if (!stricmp(param, "OFF"))
+ else if (param == "OFF")
{
nc->flags |= NI_AUTOOP;
notice_lang(s_NickServ, u, NICK_SET_AUTOOP_OFF);
@@ -444,9 +444,9 @@ class CommandNSSet : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
if (readonly)
{
@@ -460,34 +460,34 @@ class CommandNSSet : public Command
*/
if (u->nc->flags & NI_SUSPENDED)
notice_lang(s_NickServ, u, NICK_X_SUSPENDED, u->nc->display);
- else if (!stricmp(cmd, "DISPLAY"))
+ else if (cmd == "DISPLAY")
return this->DoSetDisplay(u, params, u->nc);
- else if (!stricmp(cmd, "PASSWORD"))
+ else if (cmd == "PASSWORD")
return this->DoSetPassword(u, params, u->nc);
- else if (!stricmp(cmd, "LANGUAGE"))
+ else if (cmd == "LANGUAGE")
return this->DoSetLanguage(u, params, u->nc);
- else if (!stricmp(cmd, "URL"))
+ else if (cmd == "URL")
return this->DoSetUrl(u, params, u->nc);
- else if (!stricmp(cmd, "EMAIL"))
+ else if (cmd == "EMAIL")
return this->DoSetEmail(u, params, u->nc);
- else if (!stricmp(cmd, "ICQ"))
+ else if (cmd == "ICQ")
return this->DoSetICQ(u, params, u->nc);
- else if (!stricmp(cmd, "GREET"))
+ else if (cmd == "GREET")
return this->DoSetGreet(u, params, u->nc);
- else if (!stricmp(cmd, "KILL"))
+ else if (cmd == "KILL")
return this->DoSetKill(u, params, u->nc);
- else if (!stricmp(cmd, "SECURE"))
+ else if (cmd == "SECURE")
return this->DoSetSecure(u, params, u->nc);
- else if (!stricmp(cmd, "PRIVATE"))
+ else if (cmd == "PRIVATE")
return this->DoSetPrivate(u, params, u->nc);
- else if (!stricmp(cmd, "MSG"))
+ else if (cmd == "MSG")
return this->DoSetMsg(u, params, u->nc);
- else if (!stricmp(cmd, "HIDE"))
+ else if (cmd == "HIDE")
return this->DoSetHide(u, params, u->nc);
- else if (!stricmp(cmd, "AUTOOP"))
+ else if (cmd == "AUTOOP")
return this->DoSetAutoOP(u, params, u->nc);
else
- notice_lang(s_NickServ, u, NICK_SET_UNKNOWN_OPTION, cmd);
+ notice_lang(s_NickServ, u, NICK_SET_UNKNOWN_OPTION, cmd.c_str());
return MOD_CONT;
}
diff --git a/src/core/ns_status.c b/src/core/ns_status.c
index a8b57c39b..d2f89dcb9 100644
--- a/src/core/ns_status.c
+++ b/src/core/ns_status.c
@@ -23,7 +23,7 @@ class CommandNSStatus : public Command
this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
User *u2;
NickAlias *na = NULL;
diff --git a/src/core/ns_suspend.c b/src/core/ns_suspend.c
index 06e752e14..7a6439489 100644
--- a/src/core/ns_suspend.c
+++ b/src/core/ns_suspend.c
@@ -22,7 +22,7 @@ class CommandNSSuspend : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na, *na2;
User *u2;
@@ -112,7 +112,7 @@ class CommandNSUnSuspend : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na;
const char *nick = params[0].c_str();
diff --git a/src/core/ns_update.c b/src/core/ns_update.c
index 4edf2b634..dc834794f 100644
--- a/src/core/ns_update.c
+++ b/src/core/ns_update.c
@@ -22,14 +22,12 @@ class CommandNSUpdate : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
NickAlias *na = findnick(u->nick);
if (!na)
- {
return MOD_CONT;
- }
do_setmodes(u);
check_memos(u);
diff --git a/src/core/os_akill.c b/src/core/os_akill.c
index 0b426ce3f..af0581456 100644
--- a/src/core/os_akill.c
+++ b/src/core/os_akill.c
@@ -23,7 +23,7 @@ int akill_list(int number, Akill *ak, User *u, int *sent_header);
class CommandOSAKill : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
int deleted = 0;
unsigned last_param = 2;
@@ -141,7 +141,7 @@ class CommandOSAKill : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res = 0;
@@ -192,7 +192,7 @@ class CommandOSAKill : public Command
return MOD_CONT;
}
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -237,7 +237,7 @@ class CommandOSAKill : public Command
return MOD_CONT;
}
- CommandReturn DoView(User *u, std::vector<std::string> &params)
+ CommandReturn DoView(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -278,7 +278,7 @@ class CommandOSAKill : public Command
return MOD_CONT;
}
- CommandReturn DoClear(User *u, std::vector<std::string> &params)
+ CommandReturn DoClear(User *u)
{
slist_clear(&akills, 1);
notice_lang(s_OperServ, u, OPER_AKILL_CLEAR);
@@ -290,20 +290,20 @@ class CommandOSAKill : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!stricmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->DoAdd(u, params);
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->DoDel(u, params);
- else if (!stricmp(cmd, "LIST"))
+ else if (cmd == "LIST")
return this->DoList(u, params);
- else if (!stricmp(cmd, "VIEW"))
+ else if (cmd == "VIEW")
return this->DoView(u, params);
- else if (!stricmp(cmd, "CLEAR"))
- return this->DoClear(u, params);
+ else if (cmd == "CLEAR")
+ return this->DoClear(u);
else
this->OnSyntaxError(u);
return MOD_CONT;
diff --git a/src/core/os_chankill.c b/src/core/os_chankill.c
index e620eb9bc..f9c1a6b65 100644
--- a/src/core/os_chankill.c
+++ b/src/core/os_chankill.c
@@ -22,7 +22,7 @@ class CommandOSChanKill : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *expiry, *channel;
char reason[BUFSIZE], realreason[BUFSIZE];
diff --git a/src/core/os_chanlist.c b/src/core/os_chanlist.c
index e87fa8d7c..2e34754ac 100644
--- a/src/core/os_chanlist.c
+++ b/src/core/os_chanlist.c
@@ -22,15 +22,15 @@ class CommandOSChanList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *pattern = params.size() > 0 ? params[0].c_str() : NULL;
- const char *opt = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string opt = params.size() > 1 ? params[1] : "";
int modes = 0;
User *u2;
- if (opt && !stricmp(opt, "SECRET"))
+ if (!opt.empty() && opt == "SECRET")
modes |= (anope_get_secret_mode() | anope_get_private_mode());
if (pattern && (u2 = finduser(pattern)))
diff --git a/src/core/os_clearmodes.c b/src/core/os_clearmodes.c
index 5a0250f31..933cc51fd 100644
--- a/src/core/os_clearmodes.c
+++ b/src/core/os_clearmodes.c
@@ -22,9 +22,8 @@ class CommandOSClearModes : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *s;
const char *argv[2];
const char *chan = params[0].c_str();
Channel *c;
@@ -44,9 +43,9 @@ class CommandOSClearModes : public Command
}
else
{
- s = params.size() > 1 ? params[1].c_str() : NULL;
- if (s) {
- if (!stricmp(s, "ALL"))
+ ci::string s = params.size() > 1 ? params[1] : "";
+ if (!s.empty()) {
+ if (s == "ALL")
all = 1;
else {
this->OnSyntaxError(u);
diff --git a/src/core/os_defcon.c b/src/core/os_defcon.c
index 8879ed2f7..6fc361314 100644
--- a/src/core/os_defcon.c
+++ b/src/core/os_defcon.c
@@ -24,7 +24,7 @@ class CommandOSDEFCON : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *lvl = params[0].c_str();
int newLevel = 0;
diff --git a/src/core/os_global.c b/src/core/os_global.c
index 7944280fe..399e44566 100644
--- a/src/core/os_global.c
+++ b/src/core/os_global.c
@@ -22,7 +22,7 @@ class CommandOSGlobal : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *msg = params[0].c_str();
diff --git a/src/core/os_help.c b/src/core/os_help.c
index bc0841fa9..74bfb5d20 100644
--- a/src/core/os_help.c
+++ b/src/core/os_help.c
@@ -22,9 +22,9 @@ class CommandOSHelp : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- mod_help_cmd(s_OperServ, u, OPERSERV, params.size() > 0 ? params[0].c_str() : NULL);
+ mod_help_cmd(s_OperServ, u, OPERSERV, params[0].c_str());
return MOD_CONT;
}
diff --git a/src/core/os_ignore.c b/src/core/os_ignore.c
index 51985b76f..a83ff0dea 100644
--- a/src/core/os_ignore.c
+++ b/src/core/os_ignore.c
@@ -18,7 +18,7 @@
class CommandOSIgnore : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
const char *time = params.size() > 1 ? params[1].c_str() : NULL;
const char *nick = params.size() > 2 ? params[2].c_str() : NULL;
@@ -53,7 +53,7 @@ class CommandOSIgnore : public Command
return MOD_CONT;
}
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u)
{
IgnoreData *id;
@@ -70,7 +70,7 @@ class CommandOSIgnore : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *nick = params.size() > 1 ? params[1].c_str() : NULL;
if (!nick)
@@ -88,7 +88,7 @@ class CommandOSIgnore : public Command
return MOD_CONT;
}
- CommandReturn DoClear(User *u, std::vector<std::string> &params)
+ CommandReturn DoClear(User *u)
{
clear_ignores();
notice_lang(s_OperServ, u, OPER_IGNORE_LIST_CLEARED);
@@ -100,18 +100,18 @@ class CommandOSIgnore : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!stricmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->DoAdd(u, params);
- else if (!stricmp(cmd, "LIST"))
- return this->DoList(u, params);
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "LIST")
+ return this->DoList(u);
+ else if (cmd == "DEL")
return this->DoDel(u, params);
- else if (!stricmp(cmd, "CLEAR"))
- return this->DoClear(u, params);
+ else if (cmd == "CLEAR")
+ return this->DoClear(u);
else
this->OnSyntaxError(u);
diff --git a/src/core/os_jupe.c b/src/core/os_jupe.c
index 5668c8d13..f029853d7 100644
--- a/src/core/os_jupe.c
+++ b/src/core/os_jupe.c
@@ -22,7 +22,7 @@ class CommandOSJupe : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *jserver = params[0].c_str();
const char *reason = params.size() > 1 ? params[1].c_str() : NULL;
diff --git a/src/core/os_kick.c b/src/core/os_kick.c
index fb8374f98..dc04f61a2 100644
--- a/src/core/os_kick.c
+++ b/src/core/os_kick.c
@@ -22,7 +22,7 @@ class CommandOSKick : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *argv[3];
const char *chan = params[0].c_str(), *nick = params[1].c_str(), *s = params[2].c_str();
diff --git a/src/core/os_mode.c b/src/core/os_mode.c
index aac4e1518..955601336 100644
--- a/src/core/os_mode.c
+++ b/src/core/os_mode.c
@@ -22,7 +22,7 @@ class CommandOSMode : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
int ac;
const char **av;
@@ -37,7 +37,7 @@ class CommandOSMode : public Command
{
ircdproto->SendMode(findbot(s_OperServ), chan, "%s", modes);
- ac = split_buf((char *)modes, &av, 1);
+ ac = split_buf(const_cast<char *>(modes), /* XXX */ &av, 1);
chan_set_modes(s_OperServ, c, ac, av, -1);
free(av);
diff --git a/src/core/os_modinfo.c b/src/core/os_modinfo.c
index 870cebafb..450fc4986 100644
--- a/src/core/os_modinfo.c
+++ b/src/core/os_modinfo.c
@@ -24,7 +24,7 @@ class CommandOSModInfo : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *file = params[0].c_str();
struct tm tm;
diff --git a/src/core/os_modlist.c b/src/core/os_modlist.c
index a8a7587c5..8b23c0b47 100644
--- a/src/core/os_modlist.c
+++ b/src/core/os_modlist.c
@@ -22,7 +22,7 @@ class CommandOSModList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
int idx;
int count = 0;
@@ -33,7 +33,7 @@ class CommandOSModList : public Command
int showSupported = 1;
int showQA = 1;
- const char *param = params.size() ? params[0].c_str() : NULL;
+ ci::string param = params.size() ? params[0] : "";
ModuleHash *current = NULL;
char core[] = "Core";
@@ -43,9 +43,9 @@ class CommandOSModList : public Command
char supported[] = "Supported";
char qa[] = "QATested";
- if (param)
+ if (!param.empty())
{
- if (!stricmp(param, core))
+ if (param == core)
{
showCore = 1;
showThird = 0;
@@ -54,7 +54,7 @@ class CommandOSModList : public Command
showSupported = 0;
showQA = 0;
}
- else if (!stricmp(param, third))
+ else if (param == third)
{
showCore = 0;
showThird = 1;
@@ -63,7 +63,7 @@ class CommandOSModList : public Command
showProto = 0;
showEnc = 0;
}
- else if (!stricmp(param, proto))
+ else if (param == proto)
{
showCore = 0;
showThird = 0;
@@ -72,7 +72,7 @@ class CommandOSModList : public Command
showSupported = 0;
showQA = 0;
}
- else if (!stricmp(param, supported))
+ else if (param == supported)
{
showCore = 0;
showThird = 0;
@@ -81,7 +81,7 @@ class CommandOSModList : public Command
showEnc = 0;
showQA = 0;
}
- else if (!stricmp(param, qa))
+ else if (param == qa)
{
showCore = 0;
showThird = 0;
@@ -90,7 +90,7 @@ class CommandOSModList : public Command
showEnc = 0;
showQA = 1;
}
- else if (!stricmp(param, enc))
+ else if (param == enc)
{
showCore = 0;
showThird = 0;
diff --git a/src/core/os_modload.c b/src/core/os_modload.c
index 5bef256f3..493dd3659 100644
--- a/src/core/os_modload.c
+++ b/src/core/os_modload.c
@@ -22,7 +22,7 @@ class CommandOSModLoad : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *name = params[0].c_str();
diff --git a/src/core/os_modunload.c b/src/core/os_modunload.c
index b36251c87..eb8fe8d6f 100644
--- a/src/core/os_modunload.c
+++ b/src/core/os_modunload.c
@@ -22,7 +22,7 @@ class CommandOSModUnLoad : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *name = params[0].c_str();
int status;
diff --git a/src/core/os_news.c b/src/core/os_news.c
index 3f1aeaad4..81b46526b 100644
--- a/src/core/os_news.c
+++ b/src/core/os_news.c
@@ -98,7 +98,7 @@ static int *findmsgs(int16 type, const char **type_name)
class NewsBase : public Command
{
protected:
- CommandReturn DoList(User *u, std::vector<std::string> &params, short type, int *msgs)
+ CommandReturn DoList(User *u, short type, int *msgs)
{
int i, count = 0;
char timebuf[64];
@@ -124,7 +124,7 @@ class NewsBase : public Command
return MOD_CONT;
}
- CommandReturn DoAdd(User *u, std::vector<std::string> &params, short type, int *msgs)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params, short type, int *msgs)
{
const char *text = params.size() > 1 ? params[1].c_str() : NULL;
int n;
@@ -148,7 +148,7 @@ class NewsBase : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params, short type, int *msgs)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params, short type, int *msgs)
{
const char *text = params.size() > 1 ? params[1].c_str() : NULL;
int i, num;
@@ -190,9 +190,9 @@ class NewsBase : public Command
return MOD_CONT;
}
- CommandReturn DoNews(User *u, std::vector<std::string> &params, short type)
+ CommandReturn DoNews(User *u, std::vector<ci::string> &params, short type)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
const char *type_name;
int *msgs;
@@ -209,16 +209,12 @@ class NewsBase : public Command
return MOD_CONT;
}
- if (!stricmp(cmd, "LIST"))
- return this->DoList(u, params, type, msgs);
- else if (!stricmp(cmd, "ADD"))
- {
+ if (cmd == "LIST")
+ return this->DoList(u, type, msgs);
+ else if (cmd == "ADD")
return this->DoAdd(u, params, type, msgs);
- }
- else if (!stricmp(cmd, "DEL"))
- {
+ else if (cmd == "DEL")
return this->DoDel(u, params, type, msgs);
- }
else
this->OnSyntaxError(u);
@@ -233,7 +229,7 @@ class NewsBase : public Command
{
}
- virtual CommandReturn Execute(User *u, std::vector<std::string> &params) = 0;
+ virtual CommandReturn Execute(User *u, std::vector<ci::string> &params) = 0;
virtual bool OnHelp(User *u, const ci::string &subcommand) = 0;
@@ -255,7 +251,7 @@ class CommandOSLogonNews : public NewsBase
delete [] this->help_param1;
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoNews(u, params, NEWS_LOGON);
}
@@ -298,7 +294,7 @@ class CommandOSOperNews : public NewsBase
delete [] this->help_param1;
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoNews(u, params, NEWS_OPER);
}
@@ -333,7 +329,7 @@ class CommandOSRandomNews : public NewsBase
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
return this->DoNews(u, params, NEWS_RANDOM);
}
diff --git a/src/core/os_noop.c b/src/core/os_noop.c
index e922065a2..70e16c596 100644
--- a/src/core/os_noop.c
+++ b/src/core/os_noop.c
@@ -22,12 +22,12 @@ class CommandOSNOOP : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
const char *server = params[1].c_str();
- if (!stricmp(cmd, "SET"))
+ if (cmd == "SET")
{
User *u2;
User *u3 = NULL;
@@ -49,7 +49,7 @@ class CommandOSNOOP : public Command
kill_user(s_OperServ, u2->nick, reason);
}
}
- else if (!stricmp(cmd, "REVOKE"))
+ else if (cmd == "REVOKE")
{
ircdproto->SendSVSNOOP(server, 0);
notice_lang(s_OperServ, u, OPER_NOOP_REVOKE, server);
diff --git a/src/core/os_oline.c b/src/core/os_oline.c
index ec6651f11..f364012d8 100644
--- a/src/core/os_oline.c
+++ b/src/core/os_oline.c
@@ -22,7 +22,7 @@ class CommandOSOLine : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *flag = params[1].c_str();
diff --git a/src/core/os_quit.c b/src/core/os_quit.c
index 727cc9fd5..7682689ad 100644
--- a/src/core/os_quit.c
+++ b/src/core/os_quit.c
@@ -22,7 +22,7 @@ class CommandOSQuit : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
quitmsg = new char[28 + strlen(u->nick)];
diff --git a/src/core/os_reload.c b/src/core/os_reload.c
index dad3185db..208565574 100644
--- a/src/core/os_reload.c
+++ b/src/core/os_reload.c
@@ -22,7 +22,7 @@ class CommandOSReload : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
if (!read_config(1))
{
diff --git a/src/core/os_restart.c b/src/core/os_restart.c
index 3ec4ab62e..8de76c1c4 100644
--- a/src/core/os_restart.c
+++ b/src/core/os_restart.c
@@ -22,9 +22,8 @@ class CommandOSRestart : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
-
#ifdef SERVICES_BIN
quitmsg = new char[31 + strlen(u->nick)];
if (!quitmsg)
diff --git a/src/core/os_session.c b/src/core/os_session.c
index 743aec79c..030be4a5f 100644
--- a/src/core/os_session.c
+++ b/src/core/os_session.c
@@ -18,7 +18,7 @@
class CommandOSSession : public Command
{
private:
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u, std::vector<ci::string> &params)
{
Session *session;
int mincount, i;
@@ -43,7 +43,7 @@ class CommandOSSession : public Command
return MOD_CONT;
}
- CommandReturn DoView(User *u, std::vector<std::string> &params)
+ CommandReturn DoView(User *u, std::vector<ci::string> &params)
{
const char *param = params[1].c_str();
Session *session = findsession(param);
@@ -62,9 +62,9 @@ class CommandOSSession : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
if (!LimitSessions)
{
@@ -72,9 +72,9 @@ class CommandOSSession : public Command
return MOD_CONT;
}
- if (!stricmp(cmd, "LIST"))
+ if (cmd == "LIST")
return this->DoList(u, params);
- else if (!stricmp(cmd, "VIEW"))
+ else if (cmd == "VIEW")
return this->DoView(u, params);
else
this->OnSyntaxError(u);
@@ -181,7 +181,7 @@ static int exception_view_callback(User *u, int num, va_list args)
class CommandOSException : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
const char *mask, *expiry, *limitstr;
char reason[BUFSIZE];
@@ -255,7 +255,7 @@ class CommandOSException : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *mask = params.size() > 1 ? params[1].c_str() : NULL;
int i;
@@ -314,7 +314,7 @@ class CommandOSException : public Command
return MOD_CONT;
}
- CommandReturn DoMove(User *u, std::vector<std::string> &params)
+ CommandReturn DoMove(User *u, std::vector<ci::string> &params)
{
Exception *exception;
const char *n1str = params.size() > 1 ? params[1].c_str() : NULL; /* From position */
@@ -365,7 +365,7 @@ class CommandOSException : public Command
return MOD_CONT;
}
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u, std::vector<ci::string> &params)
{
int sent_header = 0, i;
expire_exceptions();
@@ -387,7 +387,7 @@ class CommandOSException : public Command
return MOD_CONT;
}
- CommandReturn DoView(User *u, std::vector<std::string> &params)
+ CommandReturn DoView(User *u, std::vector<ci::string> &params)
{
int sent_header = 0, i;
expire_exceptions();
@@ -413,9 +413,9 @@ class CommandOSException : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
if (!LimitSessions)
{
@@ -423,19 +423,18 @@ class CommandOSException : public Command
return MOD_CONT;
}
- if (!stricmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->DoAdd(u, params);
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->DoDel(u, params);
- else if (!stricmp(cmd, "MOVE"))
+ else if (cmd == "MOVE")
return this->DoMove(u, params);
- else if (!stricmp(cmd, "LIST"))
+ else if (cmd == "LIST")
return this->DoList(u, params);
- else if (!stricmp(cmd, "VIEW"))
+ else if (cmd == "VIEW")
return this->DoView(u, params);
- else {
+ else
this->OnSyntaxError(u);
- }
return MOD_CONT;
}
diff --git a/src/core/os_set.c b/src/core/os_set.c
index 3eae0b164..60b5d5e96 100644
--- a/src/core/os_set.c
+++ b/src/core/os_set.c
@@ -18,7 +18,7 @@
class CommandOSSet : public Command
{
private:
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u)
{
int index;
@@ -36,22 +36,22 @@ class CommandOSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetIgnore(User *u, std::vector<std::string> &params)
+ CommandReturn DoSetIgnore(User *u, std::vector<ci::string> &params)
{
- const char *setting = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string setting = params.size() > 1 ? params[1] : "";
- if (!setting)
+ if (setting.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(setting, "ON"))
+ if (setting == "ON")
{
allow_ignore = 1;
notice_lang(s_OperServ, u, OPER_SET_IGNORE_ON);
}
- else if (!stricmp(setting, "OFF"))
+ else if (setting == "OFF")
{
allow_ignore = 0;
notice_lang(s_OperServ, u, OPER_SET_IGNORE_OFF);
@@ -62,24 +62,24 @@ class CommandOSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetReadOnly(User *u, std::vector<std::string> &params)
+ CommandReturn DoSetReadOnly(User *u, std::vector<ci::string> &params)
{
- const char *setting = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string setting = params.size() > 1 ? params[1] : "";
- if (!setting)
+ if (setting.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(setting, "ON"))
+ if (setting == "ON")
{
readonly = 1;
alog("Read-only mode activated");
close_log();
notice_lang(s_OperServ, u, OPER_SET_READONLY_ON);
}
- else if (!stricmp(setting, "OFF"))
+ else if (setting == "OFF")
{
readonly = 0;
open_log();
@@ -92,12 +92,12 @@ class CommandOSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetLogChan(User *u, std::vector<std::string> &params)
+ CommandReturn DoSetLogChan(User *u, std::vector<ci::string> &params)
{
- const char *setting = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string setting = params.size() > 1 ? params[1] : "";
Channel *c;
- if (!setting)
+ if (setting.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -109,7 +109,7 @@ class CommandOSSet : public Command
*
* -jester
*/
- if (LogChannel && !stricmp(setting, "ON"))
+ if (LogChannel && setting == "ON")
{
if (ircd->join2msg)
{
@@ -120,7 +120,7 @@ class CommandOSSet : public Command
alog("Now sending log messages to %s", LogChannel);
notice_lang(s_OperServ, u, OPER_SET_LOGCHAN_ON, LogChannel);
}
- else if (LogChannel && !stricmp(setting, "OFF"))
+ else if (LogChannel && setting == "OFF")
{
alog("No longer sending log messages to a channel");
if (ircd->join2msg)
@@ -134,11 +134,11 @@ class CommandOSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetSuperAdmin(User *u, std::vector<std::string> &params)
+ CommandReturn DoSetSuperAdmin(User *u, std::vector<ci::string> &params)
{
- const char *setting = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string setting = params.size() > 1 ? params[1] : "";
- if (!setting)
+ if (setting.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
@@ -151,14 +151,14 @@ class CommandOSSet : public Command
**/
if (!SuperAdmin)
notice_lang(s_OperServ, u, OPER_SUPER_ADMIN_NOT_ENABLED);
- else if (!stricmp(setting, "ON"))
+ else if (setting == "ON")
{
u->isSuperAdmin = 1;
notice_lang(s_OperServ, u, OPER_SUPER_ADMIN_ON);
alog("%s: %s is a SuperAdmin ", s_OperServ, u->nick);
ircdproto->SendGlobops(s_OperServ, getstring(OPER_SUPER_ADMIN_WALL_ON), u->nick);
}
- else if (!stricmp(setting, "OFF"))
+ else if (setting == "OFF")
{
u->isSuperAdmin = 0;
notice_lang(s_OperServ, u, OPER_SUPER_ADMIN_OFF);
@@ -171,31 +171,31 @@ class CommandOSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetDebug(User *u, std::vector<std::string> &params)
+ CommandReturn DoSetDebug(User *u, std::vector<ci::string> &params)
{
- const char *setting = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string setting = params.size() > 1 ? params[1] : "";
- if (!setting)
+ if (setting.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(setting, "ON"))
+ if (setting == "ON")
{
debug = 1;
alog("Debug mode activated");
notice_lang(s_OperServ, u, OPER_SET_DEBUG_ON);
}
- else if (!stricmp(setting, "OFF") || (*setting == '0' && !atoi(setting)))
+ else if (setting == "OFF" || (setting[0] == '0' && !atoi(setting.c_str())))
{
alog("Debug mode deactivated");
debug = 0;
notice_lang(s_OperServ, u, OPER_SET_DEBUG_OFF);
}
- else if (isdigit(*setting) && atoi(setting) > 0)
+ else if (isdigit(setting[0]) && atoi(setting.c_str()) > 0)
{
- debug = atoi(setting);
+ debug = atoi(setting.c_str());
alog("Debug mode activated (level %d)", debug);
notice_lang(s_OperServ, u, OPER_SET_DEBUG_LEVEL, debug);
}
@@ -205,23 +205,23 @@ class CommandOSSet : public Command
return MOD_CONT;
}
- CommandReturn DoSetNoExpire(User *u, std::vector<std::string> &params)
+ CommandReturn DoSetNoExpire(User *u, std::vector<ci::string> &params)
{
- const char *setting = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string setting = params.size() > 1 ? params[1] : "";
- if (!setting)
+ if (setting.empty())
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- if (!stricmp(setting, "ON"))
+ if (setting == "ON")
{
noexpire = 1;
alog("No expire mode activated");
notice_lang(s_OperServ, u, OPER_SET_NOEXPIRE_ON);
}
- else if (!stricmp(setting, "OFF"))
+ else if (setting == "OFF")
{
noexpire = 0;
alog("No expire mode deactivated");
@@ -237,26 +237,26 @@ class CommandOSSet : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *option = params[0].c_str();
+ ci::string option = params[0];
- if (!stricmp(option, "LIST"))
- return this->DoList(u, params);
- else if (!stricmp(option, "IGNORE"))
+ if (option == "LIST")
+ return this->DoList(u);
+ else if (option == "IGNORE")
return this->DoSetIgnore(u, params);
- else if (!stricmp(option, "READONLY"))
+ else if (option == "READONLY")
return this->DoSetReadOnly(u, params);
- else if (!stricmp(option, "LOGCHAN"))
+ else if (option == "LOGCHAN")
return this->DoSetLogChan(u, params);
- else if (!stricmp(option, "SUPERADMIN"))
+ else if (option == "SUPERADMIN")
return this->DoSetSuperAdmin(u, params);
- else if (!stricmp(option, "DEBUG"))
+ else if (option == "DEBUG")
return this->DoSetDebug(u, params);
- else if (!stricmp(option, "NOEXPIRE"))
+ else if (option == "NOEXPIRE")
return this->DoSetNoExpire(u, params);
else
- notice_lang(s_OperServ, u, OPER_SET_UNKNOWN_OPTION, option);
+ notice_lang(s_OperServ, u, OPER_SET_UNKNOWN_OPTION, option.c_str());
return MOD_CONT;
}
diff --git a/src/core/os_sgline.c b/src/core/os_sgline.c
index 8e7e175ec..5b33e756b 100644
--- a/src/core/os_sgline.c
+++ b/src/core/os_sgline.c
@@ -24,7 +24,7 @@ int sgline_list(int number, SXLine *sx, User *u, int *sent_header);
class CommandOSSGLine : public Command
{
private:
- CommandReturn OnAdd(User *u, std::vector<std::string> &params)
+ CommandReturn OnAdd(User *u, std::vector<ci::string> &params)
{
int deleted = 0;
unsigned last_param = 2;
@@ -142,7 +142,7 @@ class CommandOSSGLine : public Command
return MOD_CONT;
}
- CommandReturn OnDel(User *u, std::vector<std::string> &params)
+ CommandReturn OnDel(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res = 0;
@@ -192,7 +192,7 @@ class CommandOSSGLine : public Command
return MOD_CONT;
}
- CommandReturn OnList(User *u, std::vector<std::string> &params)
+ CommandReturn OnList(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -234,7 +234,7 @@ class CommandOSSGLine : public Command
return MOD_CONT;
}
- CommandReturn OnView(User *u, std::vector<std::string> &params)
+ CommandReturn OnView(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -275,7 +275,7 @@ class CommandOSSGLine : public Command
return MOD_CONT;
}
- CommandReturn OnClear(User *u, std::vector<std::string> &params)
+ CommandReturn OnClear(User *u)
{
slist_clear(&sglines, 1);
notice_lang(s_OperServ, u, OPER_SGLINE_CLEAR);
@@ -287,20 +287,20 @@ class CommandOSSGLine : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!stricmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->OnAdd(u, params);
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->OnDel(u, params);
- else if (!stricmp(cmd, "LIST"))
+ else if (cmd == "LIST")
return this->OnList(u, params);
- else if (!stricmp(cmd, "VIEW"))
+ else if (cmd == "VIEW")
return this->OnView(u, params);
- else if (!stricmp(cmd, "CLEAR"))
- return this->OnClear(u, params);
+ else if (cmd == "CLEAR")
+ return this->OnClear(u);
else
this->OnSyntaxError(u);
return MOD_CONT;
diff --git a/src/core/os_shutdown.c b/src/core/os_shutdown.c
index 60f87119d..ae141f631 100644
--- a/src/core/os_shutdown.c
+++ b/src/core/os_shutdown.c
@@ -22,7 +22,7 @@ class CommandOSShutdown : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
quitmsg = new char[32 + strlen(u->nick)];
diff --git a/src/core/os_sqline.c b/src/core/os_sqline.c
index 22c3228c8..cdbbdfaa7 100644
--- a/src/core/os_sqline.c
+++ b/src/core/os_sqline.c
@@ -23,7 +23,7 @@ int sqline_list(int number, SXLine *sx, User *u, int *sent_header);
class CommandOSSQLine : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
int deleted = 0;
unsigned last_param = 2;
@@ -128,7 +128,7 @@ class CommandOSSQLine : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res = 0;
@@ -178,7 +178,7 @@ class CommandOSSQLine : public Command
return MOD_CONT;
}
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -221,7 +221,7 @@ class CommandOSSQLine : public Command
return MOD_CONT;
}
- CommandReturn DoView(User *u, std::vector<std::string> &params)
+ CommandReturn DoView(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -262,7 +262,7 @@ class CommandOSSQLine : public Command
return MOD_CONT;
}
- CommandReturn DoClear(User *u, std::vector<std::string> &params)
+ CommandReturn DoClear(User *u)
{
slist_clear(&sqlines, 1);
notice_lang(s_OperServ, u, OPER_SQLINE_CLEAR);
@@ -274,20 +274,20 @@ class CommandOSSQLine : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!stricmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->DoAdd(u, params);
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->DoDel(u, params);
- else if (!stricmp(cmd, "LIST"))
+ else if (cmd == "LIST")
return this->DoList(u, params);
- else if (!stricmp(cmd, "VIEW"))
+ else if (cmd == "VIEW")
return this->DoView(u, params);
- else if (!stricmp(cmd, "CLEAR"))
- return this->DoClear(u, params);
+ else if (cmd == "CLEAR")
+ return this->DoClear(u);
else
this->OnSyntaxError(u);
return MOD_CONT;
diff --git a/src/core/os_staff.c b/src/core/os_staff.c
index 02c6048af..3dfbde469 100644
--- a/src/core/os_staff.c
+++ b/src/core/os_staff.c
@@ -25,7 +25,7 @@ class CommandOSStaff : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
User *au = NULL;
NickCore *nc;
diff --git a/src/core/os_stats.c b/src/core/os_stats.c
index c745a0592..1260459a6 100644
--- a/src/core/os_stats.c
+++ b/src/core/os_stats.c
@@ -40,7 +40,7 @@ int stats_count_servers(Server *s)
class CommandOSStats : public Command
{
private:
- CommandReturn DoStatsAkill(User *u, std::vector<std::string> &params)
+ CommandReturn DoStatsAkill(User *u)
{
int timeout;
/* AKILLs */
@@ -123,14 +123,14 @@ class CommandOSStats : public Command
return MOD_CONT;
}
- CommandReturn DoStatsReset(User *u, std::vector<std::string> &params)
+ CommandReturn DoStatsReset(User *u)
{
maxusercnt = usercnt;
notice_lang(s_OperServ, u, OPER_STATS_RESET);
return MOD_CONT;
}
- CommandReturn DoStatsUptime(User *u, std::vector<std::string> &params)
+ CommandReturn DoStatsUptime(User *u)
{
char timebuf[64];
time_t uptime = time(NULL) - start_time;
@@ -200,7 +200,7 @@ class CommandOSStats : public Command
return MOD_CONT;
}
- CommandReturn DoStatsUplink(User *u, std::vector<std::string> &params)
+ CommandReturn DoStatsUplink(User *u)
{
char buf[512];
int buflen, i;
@@ -240,7 +240,7 @@ class CommandOSStats : public Command
return MOD_CONT;
}
- CommandReturn DoStatsMemory(User *u, std::vector<std::string> &params)
+ CommandReturn DoStatsMemory(User *u)
{
long count, mem;
@@ -279,28 +279,28 @@ class CommandOSStats : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *extra = params.size() ? params[0].c_str() : NULL;
+ ci::string extra = params.size() ? params[0] : "";
- if (extra && stricmp(extra, "ALL"))
+ if (!extra.empty() && extra != "ALL")
{
- if (!stricmp(extra, "AKILL"))
- return this->DoStatsAkill(u, params);
- else if (!stricmp(extra, "RESET"))
- return this->DoStatsReset(u, params);
- else if (stricmp(extra, "MEMORY") && stricmp(extra, "UPLINK"))
- notice_lang(s_OperServ, u, OPER_STATS_UNKNOWN_OPTION, extra);
+ if (extra == "AKILL")
+ return this->DoStatsAkill(u);
+ else if (extra == "RESET")
+ return this->DoStatsReset(u);
+ else if (extra != "MEMORY" && extra != "UPLINK")
+ notice_lang(s_OperServ, u, OPER_STATS_UNKNOWN_OPTION, extra.c_str());
}
- if (!extra || (stricmp(extra, "MEMORY") && stricmp(extra, "UPLINK")))
- this->DoStatsUptime(u, params);
+ if (extra.empty() || (extra != "MEMORY" && extra != "UPLINK"))
+ this->DoStatsUptime(u);
- if (extra && (!stricmp(extra, "ALL") || !stricmp(extra, "UPLINK")))
- this->DoStatsUplink(u, params);
+ if (!extra.empty() && (extra == "ALL" || extra == "UPLINK"))
+ this->DoStatsUplink(u);
- if (extra && (!stricmp(extra, "ALL") || !stricmp(extra, "MEMORY")))
- this->DoStatsMemory(u, params);
+ if (!extra.empty() && (extra == "ALL" || extra == "MEMORY"))
+ this->DoStatsMemory(u);
return MOD_CONT;
}
diff --git a/src/core/os_svsnick.c b/src/core/os_svsnick.c
index e572330c0..6f25528a1 100644
--- a/src/core/os_svsnick.c
+++ b/src/core/os_svsnick.c
@@ -22,7 +22,7 @@ class CommandOSSVSNick : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *newnick = params[1].c_str();
diff --git a/src/core/os_szline.c b/src/core/os_szline.c
index e23d36d3b..8b0cfdc9d 100644
--- a/src/core/os_szline.c
+++ b/src/core/os_szline.c
@@ -23,7 +23,7 @@ int szline_list(int number, SXLine *sx, User *u, int *sent_header);
class CommandOSSZLine : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
int deleted = 0;
unsigned last_param = 2;
@@ -128,7 +128,7 @@ class CommandOSSZLine : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res = 0;
@@ -179,7 +179,7 @@ class CommandOSSZLine : public Command
return MOD_CONT;
}
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -220,7 +220,7 @@ class CommandOSSZLine : public Command
return MOD_CONT;
}
- CommandReturn DoView(User *u, std::vector<std::string> &params)
+ CommandReturn DoView(User *u, std::vector<ci::string> &params)
{
const char *mask;
int res, sent_header = 0;
@@ -261,7 +261,7 @@ class CommandOSSZLine : public Command
return MOD_CONT;
}
- CommandReturn DoClear(User *u, std::vector<std::string> &params)
+ CommandReturn DoClear(User *u)
{
slist_clear(&szlines, 1);
notice_lang(s_OperServ, u, OPER_SZLINE_CLEAR);
@@ -273,20 +273,20 @@ class CommandOSSZLine : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!stricmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->DoAdd(u, params);
- else if (!stricmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->DoDel(u, params);
- else if (!stricmp(cmd, "LIST"))
+ else if (cmd == "LIST")
return this->DoList(u, params);
- else if (!stricmp(cmd, "VIEW"))
+ else if (cmd == "VIEW")
return this->DoView(u, params);
- else if (!stricmp(cmd, "CLEAR"))
- return this->DoClear(u, params);
+ else if (cmd == "CLEAR")
+ return this->DoClear(u);
else
this->OnSyntaxError(u);
return MOD_CONT;
diff --git a/src/core/os_umode.c b/src/core/os_umode.c
index 2fd2547ef..353838eae 100644
--- a/src/core/os_umode.c
+++ b/src/core/os_umode.c
@@ -22,7 +22,7 @@ class CommandOSUMode : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *nick = params[0].c_str();
const char *modes = params[1].c_str();
diff --git a/src/core/os_update.c b/src/core/os_update.c
index ac76ee981..4a9040a13 100644
--- a/src/core/os_update.c
+++ b/src/core/os_update.c
@@ -22,7 +22,7 @@ class CommandOSUpdate : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
notice_lang(s_OperServ, u, OPER_UPDATING);
save_data = 1;
diff --git a/src/core/os_userlist.c b/src/core/os_userlist.c
index 38119688c..8ce483935 100644
--- a/src/core/os_userlist.c
+++ b/src/core/os_userlist.c
@@ -22,15 +22,15 @@ class CommandOSUserList : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *pattern = params.size() > 0 ? params[0].c_str() : NULL;
- const char *opt = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string opt = params.size() > 1 ? params[1] : "";
Channel *c;
int modes = 0;
- if (opt && !stricmp(opt, "INVISIBLE"))
+ if (!opt.empty() && opt == "INVISIBLE")
modes |= anope_get_invis_mode();
if (pattern && (c = findchan(pattern)))
diff --git a/src/core/ss_main.c b/src/core/ss_main.c
index e4fb1df15..8653c161f 100644
--- a/src/core/ss_main.c
+++ b/src/core/ss_main.c
@@ -26,7 +26,7 @@ class CommandSSHelp : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
ircdproto->SendMessage(statserv, u->nick, "This is a test of the emergency StatServ system.");
return MOD_CONT;
@@ -72,7 +72,7 @@ class SSMain : public Module
}
}
- /** This hack is necessary to replace delayed loading, for now */
+ /** This hack is necessary to replace delayed loading, for now */
void OnServerConnect(Server *)
{
statserv = findbot("StatServ");
diff --git a/src/modules/cs_appendtopic.c b/src/modules/cs_appendtopic.c
index d2c53e271..ba178ed07 100644
--- a/src/modules/cs_appendtopic.c
+++ b/src/modules/cs_appendtopic.c
@@ -57,7 +57,7 @@ class CommandCSAppendTopic : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *newtopic = params[1].c_str();
diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c
index b61295966..2e4182754 100644
--- a/src/modules/cs_enforce.c
+++ b/src/modules/cs_enforce.c
@@ -178,10 +178,10 @@ class CommandCSEnforce : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
- const char *what = params.size() > 1 ? params[1].c_str() : NULL;
+ ci::string what = params.size() > 1 ? params[1] : "";
Channel *c = findchan(chan);
ChannelInfo *ci;
@@ -196,30 +196,30 @@ class CommandCSEnforce : public Command
notice_lang(s_ChanServ, u, ACCESS_DENIED);
else
{
- if (!what || !stricmp(what, "SET"))
+ if (what.empty() || what == "SET")
{
this->DoSet(c);
- me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what ? what : "SET");
+ me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, !what.empty() ? what.c_str() : "SET");
}
- else if (!stricmp(what, "MODES"))
+ else if (what == "MODES")
{
this->DoModes(c);
- me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what);
+ me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str());
}
- else if (!stricmp(what, "SECUREOPS"))
+ else if (what == "SECUREOPS")
{
this->DoSecureOps(c);
- me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what);
+ me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str());
}
- else if (!stricmp(what, "RESTRICTED"))
+ else if (what == "RESTRICTED")
{
this->DoRestricted(c);
- me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what);
+ me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str());
}
- else if (!stricmp(what, "+R"))
+ else if (what == "+R")
{
this->DoCModeR(c);
- me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what);
+ me->NoticeLang(s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str());
}
else
this->OnSyntaxError(u);
diff --git a/src/modules/cs_tban.c b/src/modules/cs_tban.c
index ffcc3bad2..080b54d30 100644
--- a/src/modules/cs_tban.c
+++ b/src/modules/cs_tban.c
@@ -43,7 +43,7 @@ class CommandCSTBan : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
char mask[BUFSIZE];
Channel *c;
diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c
index dbd6b67eb..e249561ef 100644
--- a/src/modules/hs_request.c
+++ b/src/modules/hs_request.c
@@ -74,7 +74,7 @@ class CommandHSRequest : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
char *nick;
const char *rawhostmask = params[0].c_str();
@@ -206,7 +206,7 @@ class CommandHSActivate : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
if (!u->nc->HasPriv("hostserv/set"))
{
@@ -271,7 +271,7 @@ class CommandHSReject : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
if (!u->nc->HasPriv("hostserv/set"))
{
@@ -330,7 +330,7 @@ class CommandHSReject : public Command
class HSListBase : public Command
{
protected:
- CommandReturn DoList(User *u, std::vector<std::string> &params)
+ CommandReturn DoList(User *u)
{
if (!u->nc->HasPriv("hostserv/set"))
{
@@ -383,9 +383,9 @@ class CommandHSWaiting : public HSListBase
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- return this->DoList(u, params);
+ return this->DoList(u);
}
bool OnHelp(User *u, const ci::string &subcommand)
@@ -691,17 +691,17 @@ class HSRequest : public Module
delete [] HSRequestDBName;
}
- EventReturn OnPreCommand(User *u, const std::string &service, const std::string &command, const std::vector<std::string> &params)
+ EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> &params)
{
if (service == s_HostServ)
{
if (command == "LIST")
{
- const char *key = params.size() ? params[0].c_str() : NULL;
+ ci::string key = params.size() ? params[0] : "";
- if (key && !stricmp(key, "+req"))
+ if (!key.empty() && key == "+req")
{
- std::vector<std::string> emptyParams;
+ std::vector<ci::string> emptyParams;
Command *c = findCommand(HOSTSERV, "WAITING");
c->Execute(u, emptyParams);
return EVENT_STOP;
diff --git a/src/modules/ns_maxemail.c b/src/modules/ns_maxemail.c
index 3a93eb5d7..819f48265 100644
--- a/src/modules/ns_maxemail.c
+++ b/src/modules/ns_maxemail.c
@@ -101,7 +101,7 @@ class NSMaxEmail : public Module
my_load_config();
}
- EventReturn OnPreCommand(User *u, const std::string &service, const std::string &command, const std::vector<std::string> &params)
+ EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> &params)
{
if (service == s_NickServ)
{
@@ -112,10 +112,10 @@ class NSMaxEmail : public Module
}
else if (command == "SET")
{
- const char *set = params[0].c_str();
+ ci::string set = params[0];
const char *email = params.size() > 1 ? params[1].c_str() : NULL;
- if (!stricmp(set, "email") && check_email_limit_reached(email, u))
+ if (set == "email" && check_email_limit_reached(email, u))
return EVENT_STOP;
}
}
diff --git a/src/modules/os_info.c b/src/modules/os_info.c
index fcd20d9bb..04ace5f12 100644
--- a/src/modules/os_info.c
+++ b/src/modules/os_info.c
@@ -52,7 +52,7 @@ static Module *me;
class CommandNSOInfo : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
const char *nick = params[1].c_str();
const char *info = params.size() > 2 ? params[2].c_str() : NULL;
@@ -83,7 +83,7 @@ class CommandNSOInfo : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *nick = params[1].c_str();
NickAlias *na = NULL;
@@ -110,13 +110,13 @@ class CommandNSOInfo : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[0].c_str();
+ ci::string cmd = params[0];
- if (!strcasecmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->DoAdd(u, params);
- else if (!strcasecmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->DoDel(u, params);
else
this->OnSyntaxError(u);
@@ -141,7 +141,7 @@ class CommandNSOInfo : public Command
class CommandCSOInfo : public Command
{
private:
- CommandReturn DoAdd(User *u, std::vector<std::string> &params)
+ CommandReturn DoAdd(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
const char *info = params.size() > 2 ? params[2].c_str() : NULL;
@@ -166,7 +166,7 @@ class CommandCSOInfo : public Command
return MOD_CONT;
}
- CommandReturn DoDel(User *u, std::vector<std::string> &params)
+ CommandReturn DoDel(User *u, std::vector<ci::string> &params)
{
const char *chan = params[0].c_str();
ChannelInfo *ci = cs_findchan(chan);
@@ -187,13 +187,13 @@ class CommandCSOInfo : public Command
{
}
- CommandReturn Execute(User *u, std::vector<std::string> &params)
+ CommandReturn Execute(User *u, std::vector<ci::string> &params)
{
- const char *cmd = params[1].c_str();
+ ci::string cmd = params[1];
- if (!strcasecmp(cmd, "ADD"))
+ if (cmd == "ADD")
return this->DoAdd(u, params);
- else if (!strcasecmp(cmd, "DEL"))
+ else if (cmd == "DEL")
return this->DoDel(u, params);
else
this->OnSyntaxError(u);
@@ -502,7 +502,7 @@ class OSInfo : public Module
alog("os_info.c: ERROR: An error has occured while reloading the configuration file");
}
- void OnPostCommand(User *u, const std::string &service, const std::string &command, const std::vector<std::string> &params)
+ void OnPostCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> &params)
{
if (command == "INFO")
{