diff options
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> ¶ms) { return EVENT_CONTINUE; } + virtual EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> ¶ms) { 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> ¶ms) { } + virtual void OnPostCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> ¶ms) { } /** 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> ¶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/ |
