summaryrefslogtreecommitdiff
path: root/modules/core/os_modinfo.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-11-24 21:40:56 -0600
committerAdam <Adam@anope.org>2010-12-12 19:36:19 -0500
commitcb6ef574e3df5cc846247450b74ca37d265f319e (patch)
tree8ce3374a537c312af63c78125bfea4622bb188f0 /modules/core/os_modinfo.cpp
parent37e02a3594fdddc3d5a3df0501c528f42db6c4da (diff)
Send replies from fantasy commands back to the channel, this will be expanded on later
Diffstat (limited to 'modules/core/os_modinfo.cpp')
-rw-r--r--modules/core/os_modinfo.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/modules/core/os_modinfo.cpp b/modules/core/os_modinfo.cpp
index 218599f47..464519d1b 100644
--- a/modules/core/os_modinfo.cpp
+++ b/modules/core/os_modinfo.cpp
@@ -13,33 +13,53 @@
#include "module.h"
-static int showModuleCmdLoaded(BotInfo *bi, const Anope::string &mod_name, User *u);
class CommandOSModInfo : public Command
{
+ int showModuleCmdLoaded(BotInfo *bi, const Anope::string &mod_name, CommandSource &source)
+ {
+ if (!bi)
+ return 0;
+
+ int display = 0;
+
+ for (CommandMap::iterator it = bi->Commands.begin(), it_end = bi->Commands.end(); it != it_end; ++it)
+ {
+ Command *c = it->second;
+
+ if (c->module && c->module->name.equals_ci(mod_name) && c->service)
+ {
+ source.Reply(OPER_MODULE_CMD_LIST, c->service->nick.c_str(), c->name.c_str());
+ ++display;
+ }
+ }
+
+ return display;
+ }
+
public:
CommandOSModInfo() : Command("MODINFO", 1, 1)
{
}
- CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
+ CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> &params)
{
- Anope::string file = params[0];
+ const Anope::string &file = params[0];
Module *m = FindModule(file);
if (m)
{
- u->SendMessage(OperServ, OPER_MODULE_INFO_LIST, m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "?", do_strftime(m->created).c_str());
-
- showModuleCmdLoaded(HostServ, m->name, u);
- showModuleCmdLoaded(OperServ, m->name, u);
- showModuleCmdLoaded(NickServ, m->name, u);
- showModuleCmdLoaded(ChanServ, m->name, u);
- showModuleCmdLoaded(BotServ, m->name, u);
- showModuleCmdLoaded(MemoServ, m->name, u);
+ source.Reply(OPER_MODULE_INFO_LIST, m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "?", do_strftime(m->created).c_str());
+
+ showModuleCmdLoaded(HostServ, m->name, source);
+ showModuleCmdLoaded(OperServ, m->name, source);
+ showModuleCmdLoaded(NickServ, m->name, source);
+ showModuleCmdLoaded(ChanServ, m->name, source);
+ showModuleCmdLoaded(BotServ, m->name, source);
+ showModuleCmdLoaded(MemoServ, m->name, source);
}
else
- u->SendMessage(OperServ, OPER_MODULE_NO_INFO, file.c_str());
+ source.Reply(OPER_MODULE_NO_INFO, file.c_str());
return MOD_CONT;
}
@@ -75,24 +95,4 @@ class OSModInfo : public Module
}
};
-static int showModuleCmdLoaded(BotInfo *bi, const Anope::string &mod_name, User *u)
-{
- if (!bi)
- return 0;
-
- int display = 0;
-
- for (CommandMap::iterator it = bi->Commands.begin(), it_end = bi->Commands.end(); it != it_end; ++it)
- {
- Command *c = it->second;
-
- if (c->module && c->module->name.equals_ci(mod_name) && c->service)
- {
- u->SendMessage(OperServ, OPER_MODULE_CMD_LIST, c->service->nick.c_str(), c->name.c_str());
- ++display;
- }
- }
- return display;
-}
-
MODULE_INIT(OSModInfo)