diff options
Diffstat (limited to 'src/core')
111 files changed, 729 insertions, 803 deletions
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> ¶ms) + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn DoAdd(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn DoChange(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn DoDel(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { - 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> ¶ms) + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { 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> ¶ms) + CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) { 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 Co |
