diff options
| author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-07-25 00:37:43 +0000 |
|---|---|---|
| committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-07-25 00:37:43 +0000 |
| commit | b2a57b09742da6c2f2011ad41eb470139d88e14f (patch) | |
| tree | 054e41a724108706c5ea5f659d2065fe5fae2504 /src | |
| parent | 443654f15bf036bb18f9847332e2bd03ec823b3d (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
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 |
