1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 06:56:39 +02:00

Update os_config

This commit is contained in:
Adam
2014-01-02 11:41:49 -05:00
parent 004c4cbe5f
commit 1e502c8450
+37 -2
View File
@@ -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<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"));