mirror of https://github.com/SeanOMik/znc-push.git
Add option for service name
Currently enforces either "notifo" or "boxcar", but does not yet change any behaviors in the rest of the module. Also prevents appending or prepending to the option value. Issue #226
This commit is contained in:
parent
1f76601c56
commit
7817e98dba
|
@ -53,6 +53,7 @@ Then set your Notifo username and API secret. The API secret is not your passwo
|
|||
can be obtained by logging into Notifo's website, clicking Settings, and then "Click to
|
||||
Show" next to the "API Secret" heading:
|
||||
|
||||
/msg *push set service notifo
|
||||
/msg *push set username foo
|
||||
/msg *push set secret ...
|
||||
|
||||
|
@ -70,6 +71,7 @@ to set your configuration all over again:
|
|||
|
||||
/msg *notifo save /tmp/znc_notifo
|
||||
/msg *push load /tmp/znc_notifo
|
||||
/msg *push set service notifo
|
||||
|
||||
|
||||
Commands
|
||||
|
|
32
push.cpp
32
push.cpp
|
@ -88,7 +88,8 @@ class CPushMod : public CModule
|
|||
// Current user
|
||||
user = GetUser();
|
||||
|
||||
// Notifo user account and secret
|
||||
// Push service information
|
||||
defaults["service"] = "";
|
||||
defaults["username"] = "";
|
||||
defaults["secret"] = "";
|
||||
|
||||
|
@ -782,6 +783,8 @@ class CPushMod : public CModule
|
|||
}
|
||||
else
|
||||
{
|
||||
value.Trim();
|
||||
|
||||
if (option == "channel_conditions" || option == "query_conditions")
|
||||
{
|
||||
if (value != "all")
|
||||
|
@ -789,9 +792,26 @@ class CPushMod : public CModule
|
|||
eval(value);
|
||||
}
|
||||
}
|
||||
else if (option == "service")
|
||||
{
|
||||
value.MakeLower();
|
||||
|
||||
if (value == "notifo")
|
||||
{
|
||||
PutModule("Note: Notifo requires setting both 'username' and 'secret' options");
|
||||
}
|
||||
else if (value == "boxcar")
|
||||
{
|
||||
PutModule("Note: Boxcar requires setting the 'username' option");
|
||||
}
|
||||
else
|
||||
{
|
||||
PutModule("Error: unknown service name");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
options[option] = value;
|
||||
options[option].Trim();
|
||||
SetNV(option, options[option]);
|
||||
|
||||
authencode();
|
||||
|
@ -814,6 +834,10 @@ class CPushMod : public CModule
|
|||
{
|
||||
PutModule("Error: invalid option name");
|
||||
}
|
||||
else if (option == "service")
|
||||
{
|
||||
PutModule("Error: cannot append to this option");
|
||||
}
|
||||
else
|
||||
{
|
||||
options[option] += " " + value;
|
||||
|
@ -840,6 +864,10 @@ class CPushMod : public CModule
|
|||
{
|
||||
PutModule("Error: invalid option name");
|
||||
}
|
||||
else if (option == "service")
|
||||
{
|
||||
PutModule("Error: cannot prepend to this option");
|
||||
}
|
||||
else
|
||||
{
|
||||
options[option] = value + " " + options[option];
|
||||
|
|
Loading…
Reference in New Issue