diff options
Diffstat (limited to 'modules/commands/os_config.cpp')
-rw-r--r-- | modules/commands/os_config.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/modules/commands/os_config.cpp b/modules/commands/os_config.cpp index 5923c9e02..6dc932cf2 100644 --- a/modules/commands/os_config.cpp +++ b/modules/commands/os_config.cpp @@ -28,6 +28,9 @@ class CommandOSConfig : public Command { Configuration::Block *block = Config->GetBlock(params[1]); if (!block) + block = Config->GetModule(params[1]); + + if (!block) { source.Reply(_("There is no such configuration block %s."), params[1].c_str()); return; @@ -41,7 +44,7 @@ class CommandOSConfig : public Command else if (what.equals_ci("VIEW")) { /* Blocks we should show */ - const Anope::string show_blocks[] = { "botserv", "chanserv", "defcon", "global", "memoserv", "nickserv", "networkinfo", "operserv", "options", "" }; + const Anope::string show_blocks[] = { "serverinfo", "networkinfo", "options", "" }; Log(LOG_ADMIN, source, this) << "VIEW"; @@ -71,8 +74,40 @@ class CommandOSConfig : public Command for (unsigned j = 0; j < replies.size(); ++j) source.Reply(replies[j]); + + source.Reply(" "); } + ListFormatter lflist(source.GetAccount()); + lflist.AddColumn(_("Module Name")).AddColumn(_("Name")).AddColumn(_("Value")); + + for (int i = 0; i < Config->CountBlock("module"); ++i) + { + Configuration::Block *block = Config->GetBlock("module", i); + const Configuration::Block::item_map *items = block->GetItems(); + + if (!items || items->size() <= 1) + continue; + + ListFormatter::ListEntry entry; + entry["Module Name"] = block->Get<Anope::string>("name"); + + for (Configuration::Block::item_map::const_iterator it = items->begin(), it_end = items->end(); it != it_end; ++it) + { + entry["Name"] = it->first; + entry["Value"] = it->second; + lflist.AddEntry(entry); + } + } + + std::vector<Anope::string> replies; + lflist.Process(replies); + + source.Reply(_("Module settings:")); + + for (unsigned j = 0; j < replies.size(); ++j) + source.Reply(replies[j]); + source.Reply(_("End of configuration.")); } else @@ -86,7 +121,7 @@ class CommandOSConfig : public Command source.Reply(_("Allows you to change and view configuration settings.\n" "Settings changed by this command are temporary and will not be reflected\n" "back into the configuration file, and will be lost if Anope is shut down,\n" - "restarted, or the RELOAD command is used.\n" + "restarted, or the configuration is reloaded.\n" " \n" "Example:\n" " \002MODIFY nickserv forcemail no\002")); |