diff options
Diffstat (limited to 'src')
119 files changed, 774 insertions, 848 deletions
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> ¶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 |
