Merge pull request #222 from appzer/master

add Pushsafer notification service
This commit is contained in:
John Reese 2017-03-03 10:00:36 -08:00 committed by GitHub
commit 27dbd7e628
2 changed files with 87 additions and 48 deletions

View File

@ -15,6 +15,7 @@ conditions. ZNC Push current supports the following services:
* [Boxcar 2][] * [Boxcar 2][]
* [Notify My Android][] (NMA) * [Notify My Android][] (NMA)
* [Pushover][] * [Pushover][]
* [Pushsafer][]
* [Prowl][] * [Prowl][]
* [Supertoasty][] * [Supertoasty][]
* [PushBullet][] * [PushBullet][]
@ -244,6 +245,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* `boxcar` * `boxcar`
* `nma` * `nma`
* `pushover` * `pushover`
* `pushsafer`
* `prowl` * `prowl`
* `supertoasty` * `supertoasty`
* `pushbullet` * `pushbullet`
@ -266,7 +268,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
Authentication token for push notifications. Authentication token for push notifications.
This option must be set when using Notify My Android, Pushover, Prowl, Supertoasty, PushBullet, Nexmo, Pushjet, or Telegram. This option must be set when using Notify My Android, Pushover, Pushsafer, Prowl, Supertoasty, PushBullet, Nexmo, Pushjet, or Telegram.
When using the custom URL service, if this option is set it will enable HTTP basic When using the custom URL service, if this option is set it will enable HTTP basic
authentication and be used as password. authentication and be used as password.
@ -285,6 +287,8 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
When using Telegram, this is the id of the chat that receives the message. When using Telegram, this is the id of the chat that receives the message.
When using Pushsafer, this is the id or group id of your devices.
### Notifications ### Notifications
@ -323,7 +327,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* `message_uri_title` Default: ` ` * `message_uri_title` Default: ` `
If you're using Pushover.net, you can specify a title for the `message_uri` option. If you're using Pushover.net or Pushsafer.com, you can specify a title for the `message_uri` option.
* `message_priority` Default: ` ` * `message_priority` Default: ` `
@ -333,9 +337,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* `message_sound` Default: ` ` * `message_sound` Default: ` `
Notification sound to play with the push notification. Notification sound to play with the push notification.
Supported under Pushover, Faast, and Boxcar 2. Must be chosen from the list of Supported under Pushover, Pushsafer, Faast, and Boxcar 2. Must be chosen from the list of [Pushover sounds](https://pushover.net/api#sounds), [Pushsafer sounds](https://www.pushsafer.com/en/pushapi), [Faast sounds](http://developer.faast.io/) or [Boxcar 2 sounds](https://boxcar.uservoice.com/knowledgebase/articles/306788-how-to-send-your-boxcar-account-a-notification).
[Pushover sounds](https://pushover.net/api#sounds), [Faast sounds](http://developer.faast.io/)
or [Boxcar 2 sounds](https://boxcar.uservoice.com/knowledgebase/articles/306788-how-to-send-your-boxcar-account-a-notification).
### Conditions ### Conditions
@ -528,6 +530,7 @@ from me and not from my employer. See the `LICENSE` file for details.
[Boxcar 2]: http://boxcar.io [Boxcar 2]: http://boxcar.io
[Notify My Android]: http://www.notifymyandroid.com [Notify My Android]: http://www.notifymyandroid.com
[Pushover]: http://pushover.net [Pushover]: http://pushover.net
[Pushsafer]: http://www.pushsafer.com
[Prowl]: http://www.prowlapp.com [Prowl]: http://www.prowlapp.com
[Supertoasty]: http://www.supertoasty.com [Supertoasty]: http://www.supertoasty.com
[PushBullet]: https://www.pushbullet.com/ [PushBullet]: https://www.pushbullet.com/

View File

@ -411,7 +411,42 @@ class CPushMod : public CModule
params["priority"] = options["message_priority"]; params["priority"] = options["message_priority"];
} }
} }
else if (service == "pushsafer")
{
if (options["secret"] == "")
{
PutModule("Error: privatekey (private or alias key) not set");
return;
}
service_host = "pushsafer.com";
service_url = "/api";
params["k"] = options["secret"];
params["t"] = message_title;
params["m"] = message_content;
if (message_uri != "")
{
params["u"] = message_uri;
}
if (options["message_uri_title"] != "" )
{
params["ut"] = options["message_uri_title"];
}
if (options["target"] != "")
{
params["d"] = options["target"];
}
if (options["message_sound"] != "" )
{
params["s"] = options["message_sound"];
}
}
else if (service == "pushalot") else if (service == "pushalot")
{ {
if (options["secret"] == "") if (options["secret"] == "")
@ -437,7 +472,6 @@ class CPushMod : public CModule
params["LinkTitle"] = options["message_uri_title"]; params["LinkTitle"] = options["message_uri_title"];
} }
} }
else if (service == "prowl") else if (service == "prowl")
{ {
if (options["secret"] == "") if (options["secret"] == "")
@ -527,7 +561,6 @@ class CPushMod : public CModule
params["from"] = message_title; params["from"] = message_title;
params["to"] = options["target"]; params["to"] = options["target"];
params["text"] = message_content; params["text"] = message_content;
} }
else if (service == "url") else if (service == "url")
{ {
@ -1383,11 +1416,14 @@ class CPushMod : public CModule
{ {
PutModule("Note: Pushover requires setting both the 'username' (to user key) and the 'secret' (to application api key) option"); PutModule("Note: Pushover requires setting both the 'username' (to user key) and the 'secret' (to application api key) option");
} }
else if (value == "pushsafer")
{
PutModule("Note: Pushsafer requires setting the 'private or alias key' option");
}
else if (value == "pushalot") else if (value == "pushalot")
{ {
PutModule("Note: Pushalot requires setting the 'secret' (to user key) (to authorization token) option"); PutModule("Note: Pushalot requires setting the 'secret' (to user key) (to authorization token) option");
} }
else if (value == "prowl") else if (value == "prowl")
{ {
PutModule("Note: Prowl requires setting the 'secret' option"); PutModule("Note: Prowl requires setting the 'secret' option");