summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-05-17 22:53:55 -0400
committerAdam <Adam@anope.org>2013-05-17 22:53:55 -0400
commitcc4a14b0badfe3d617ec2dd230d7921f8650a069 (patch)
tree73ded53114ee7b100c548bdb448a6cc36b392da8 /src
parent934b5843744e586ce9a3c7725a19c7ddffe14ee8 (diff)
Removed some hard coded command names in help output
Diffstat (limited to 'src')
-rw-r--r--src/bots.cpp2
-rw-r--r--src/command.cpp27
2 files changed, 27 insertions, 2 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index fcbedeeb3..332bd151d 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -201,7 +201,7 @@ void BotInfo::OnMessage(User *u, const Anope::string &message)
return;
CommandSource source(u->nick, u, u->Account(), u, this);
- RunCommand(source, message);
+ Command::Run(source, message);
}
CommandInfo& BotInfo::SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission)
diff --git a/src/command.cpp b/src/command.cpp
index b7289b848..421c90b93 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -194,7 +194,7 @@ void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcomma
source.Reply(MORE_INFO, Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str());
}
-void RunCommand(CommandSource &source, const Anope::string &message)
+void Command::Run(CommandSource &source, const Anope::string &message)
{
std::vector<Anope::string> params;
spacesepstream(message).GetTokens(params);
@@ -282,3 +282,28 @@ void RunCommand(CommandSource &source, const Anope::string &message)
FOREACH_MOD(I_OnPostCommand, OnPostCommand(source, c, params));
}
+bool Command::FindCommandFromService(const Anope::string &command_service, BotInfo* &bot, Anope::string &name)
+{
+ bot = NULL;
+
+ for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
+ {
+ BotInfo *bi = it->second;
+
+ for (CommandInfo::map::const_iterator cit = bi->commands.begin(), cit_end = bi->commands.end(); cit != cit_end; ++cit)
+ {
+ const Anope::string &c_name = cit->first;
+ const CommandInfo &info = cit->second;
+
+ if (info.name != command_service)
+ continue;
+
+ bot = bi;
+ name = c_name;
+ return true;
+ }
+ }
+
+ return false;
+}
+