diff --git a/README.md b/README.md index 33e0aa0..5c13a20 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/push.cpp b/push.cpp index 1170c71..769fb46 100644 --- a/push.cpp +++ b/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];