Implemented APPEND command for modifying config values

This commit is contained in:
John Reese 2011-01-19 11:36:07 -05:00
parent d4fd3ce741
commit f2de10139c
2 changed files with 32 additions and 0 deletions

View File

@ -69,6 +69,11 @@ Commands
Allows you to modify configuration values. Allows you to modify configuration values.
* `append <option> <value>`
Allows you to add a string to end of a configuration value. Automatically adds a
space to separate the appended value from the existing value.
* `get [<option>]` * `get [<option>]`
Allows you to see current configuration values. Allows you to see current configuration values.

View File

@ -547,6 +547,33 @@ class CNotifoMod : public CModule
else else
{ {
options[option] = value; options[option] = value;
options[option].Trim();
SetNV(option, value);
authencode();
}
}
// APPEND command
else if (action == "append")
{
if (token_count < 3)
{
PutModule("Usage: append <option> <value>");
return;
}
CString option = tokens[1].AsLower();
CString value = command.Token(2, true, " ");
MCString::iterator pos = options.find(option);
if (pos == options.end())
{
PutModule("Error: invalid option name");
}
else
{
options[option] += " " + value;
options[option].Trim();
SetNV(option, value); SetNV(option, value);
authencode(); authencode();