From b2a57b09742da6c2f2011ad41eb470139d88e14f Mon Sep 17 00:00:00 2001 From: cyberbotx Date: Sat, 25 Jul 2009 00:37:43 +0000 Subject: Changed params parameter of Command's Execute() from std::vector to std::vector, 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 --- src/modules/cs_appendtopic.c | 2 +- src/modules/cs_enforce.c | 24 ++++++++++++------------ src/modules/cs_tban.c | 2 +- src/modules/hs_request.c | 20 ++++++++++---------- src/modules/ns_maxemail.c | 6 +++--- src/modules/os_info.c | 26 +++++++++++++------------- 6 files changed, 40 insertions(+), 40 deletions(-) (limited to 'src/modules') 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 ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { 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 ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { 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 ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { 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 ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { char *nick; const char *rawhostmask = params[0].c_str(); @@ -206,7 +206,7 @@ class CommandHSActivate : public Command { } - CommandReturn Execute(User *u, std::vector ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { if (!u->nc->HasPriv("hostserv/set")) { @@ -271,7 +271,7 @@ class CommandHSReject : public Command { } - CommandReturn Execute(User *u, std::vector ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { 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 ¶ms) + CommandReturn DoList(User *u) { if (!u->nc->HasPriv("hostserv/set")) { @@ -383,9 +383,9 @@ class CommandHSWaiting : public HSListBase { } - CommandReturn Execute(User *u, std::vector ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { - 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 ¶ms) + EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector ¶ms) { 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 emptyParams; + std::vector 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 ¶ms) + EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector ¶ms) { 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 ¶ms) + CommandReturn DoAdd(User *u, std::vector ¶ms) { 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 ¶ms) + CommandReturn DoDel(User *u, std::vector ¶ms) { const char *nick = params[1].c_str(); NickAlias *na = NULL; @@ -110,13 +110,13 @@ class CommandNSOInfo : public Command { } - CommandReturn Execute(User *u, std::vector ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { - 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 ¶ms) + CommandReturn DoAdd(User *u, std::vector ¶ms) { 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 ¶ms) + CommandReturn DoDel(User *u, std::vector ¶ms) { 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 ¶ms) + CommandReturn Execute(User *u, std::vector ¶ms) { - 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 ¶ms) + void OnPostCommand(User *u, const std::string &service, const ci::string &command, const std::vector ¶ms) { if (command == "INFO") { -- cgit