mirror of https://github.com/SeanOMik/znc-push.git
Implemented PREPEND command for modifying config values
This commit is contained in:
parent
f2de10139c
commit
74c813a656
|
@ -74,6 +74,11 @@ Commands
|
||||||
Allows you to add a string to end of a configuration value. Automatically adds a
|
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.
|
space to separate the appended value from the existing value.
|
||||||
|
|
||||||
|
* `prepend <option> <value>`
|
||||||
|
|
||||||
|
Allows you to add a string to beginning of a configuration value. Automatically adds
|
||||||
|
a space to separate the prepended value from the existing value.
|
||||||
|
|
||||||
* `get [<option>]`
|
* `get [<option>]`
|
||||||
|
|
||||||
Allows you to see current configuration values.
|
Allows you to see current configuration values.
|
||||||
|
|
30
notifo.cpp
30
notifo.cpp
|
@ -548,7 +548,7 @@ class CNotifoMod : public CModule
|
||||||
{
|
{
|
||||||
options[option] = value;
|
options[option] = value;
|
||||||
options[option].Trim();
|
options[option].Trim();
|
||||||
SetNV(option, value);
|
SetNV(option, options[option]);
|
||||||
|
|
||||||
authencode();
|
authencode();
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,33 @@ class CNotifoMod : public CModule
|
||||||
{
|
{
|
||||||
options[option] += " " + value;
|
options[option] += " " + value;
|
||||||
options[option].Trim();
|
options[option].Trim();
|
||||||
SetNV(option, value);
|
SetNV(option, options[option]);
|
||||||
|
|
||||||
|
authencode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// PREPEND command
|
||||||
|
else if (action == "prepend")
|
||||||
|
{
|
||||||
|
if (token_count < 3)
|
||||||
|
{
|
||||||
|
PutModule("Usage: prepend <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];
|
||||||
|
options[option].Trim();
|
||||||
|
SetNV(option, options[option]);
|
||||||
|
|
||||||
authencode();
|
authencode();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue