summaryrefslogtreecommitdiff
path: root/modules/core/os_modinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/os_modinfo.cpp')
-rw-r--r--modules/core/os_modinfo.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/modules/core/os_modinfo.cpp b/modules/core/os_modinfo.cpp
index 2817b8f72..6634d2939 100644
--- a/modules/core/os_modinfo.cpp
+++ b/modules/core/os_modinfo.cpp
@@ -12,16 +12,14 @@
/*************************************************************************/
#include "module.h"
-
+#include "operserv.h"
class CommandOSModInfo : public Command
{
- int showModuleCmdLoaded(BotInfo *bi, const Anope::string &mod_name, CommandSource &source)
+ void showModuleCmdLoaded(BotInfo *bi, const Anope::string &mod_name, CommandSource &source)
{
if (!bi)
- return 0;
-
- int display = 0;
+ return;
for (CommandMap::iterator it = bi->Commands.begin(), it_end = bi->Commands.end(); it != it_end; ++it)
{
@@ -30,11 +28,8 @@ class CommandOSModInfo : public Command
if (c->module && c->module->name.equals_ci(mod_name) && c->service)
{
source.Reply(_("Providing command: %\002%s %s\002"), c->service->nick.c_str(), c->name.c_str());
- ++display;
}
}
-
- return display;
}
public:
@@ -52,12 +47,8 @@ class CommandOSModInfo : public Command
{
source.Reply(_("Module: \002%s\002 Version: \002%s\002 Author: \002%s\002 loaded: \002%s\002"), 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);
+ for (Anope::insensitive_map<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ this->showModuleCmdLoaded(it->second, m->name, source);
}
else
source.Reply(_("No information about module \002%s\002 is available"), file.c_str());
@@ -89,7 +80,10 @@ class OSModInfo : public Module
this->SetAuthor("Anope");
this->SetType(CORE);
- this->AddCommand(OperServ, &commandosmodinfo);
+ if (!operserv)
+ throw ModuleException("OperServ is not loaded!");
+
+ this->AddCommand(operserv->Bot(), &commandosmodinfo);
}
};