From 1e502c845085ca140fb38745bd9f13643dff16f5 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 2 Jan 2014 11:41:49 -0500 Subject: Update os_config --- modules/commands/os_config.cpp | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'modules/commands/os_config.cpp') 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 @@ -27,6 +27,9 @@ class CommandOSConfig : public Command if (what.equals_ci("MODIFY") && params.size() > 3) { 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()); @@ -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("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 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")); -- cgit