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 | |
| 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
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 { } - CommandRetu |
