mirror of https://github.com/SeanOMik/znc-push.git
Merge pull request #222 from appzer/master
add Pushsafer notification service
This commit is contained in:
commit
27dbd7e628
15
README.md
15
README.md
|
@ -15,6 +15,7 @@ conditions. ZNC Push current supports the following services:
|
|||
* [Boxcar 2][]
|
||||
* [Notify My Android][] (NMA)
|
||||
* [Pushover][]
|
||||
* [Pushsafer][]
|
||||
* [Prowl][]
|
||||
* [Supertoasty][]
|
||||
* [PushBullet][]
|
||||
|
@ -244,6 +245,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
|
|||
* `boxcar`
|
||||
* `nma`
|
||||
* `pushover`
|
||||
* `pushsafer`
|
||||
* `prowl`
|
||||
* `supertoasty`
|
||||
* `pushbullet`
|
||||
|
@ -266,7 +268,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
|
|||
|
||||
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
|
||||
authentication and be used as password.
|
||||
|
@ -277,7 +279,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
|
|||
|
||||
When using Pushover or PushBullet, this option allows you to specify a
|
||||
single device to send notifications to; if blank or unset, notifications
|
||||
will be sent to all devices. For Pushover, this is the device name; for
|
||||
will be sent to all devices. For Pushover, this is the device name; for
|
||||
PushBullet, this is the device_iden.
|
||||
|
||||
When using Nexmo, this option allows you to specify the SMS destination
|
||||
|
@ -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 Pushsafer, this is the id or group id of your devices.
|
||||
|
||||
|
||||
### Notifications
|
||||
|
||||
|
@ -323,7 +327,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
|
|||
|
||||
* `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: ` `
|
||||
|
||||
|
@ -333,9 +337,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
|
|||
* `message_sound` Default: ` `
|
||||
|
||||
Notification sound to play with the push notification.
|
||||
Supported under Pushover, Faast, and Boxcar 2. Must be chosen from the list of
|
||||
[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).
|
||||
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).
|
||||
|
||||
|
||||
### Conditions
|
||||
|
@ -528,6 +530,7 @@ from me and not from my employer. See the `LICENSE` file for details.
|
|||
[Boxcar 2]: http://boxcar.io
|
||||
[Notify My Android]: http://www.notifymyandroid.com
|
||||
[Pushover]: http://pushover.net
|
||||
[Pushsafer]: http://www.pushsafer.com
|
||||
[Prowl]: http://www.prowlapp.com
|
||||
[Supertoasty]: http://www.supertoasty.com
|
||||
[PushBullet]: https://www.pushbullet.com/
|
||||
|
|
120
push.cpp
120
push.cpp
|
@ -411,14 +411,49 @@ class CPushMod : public CModule
|
|||
params["priority"] = options["message_priority"];
|
||||
}
|
||||
}
|
||||
|
||||
else if (service == "pushalot")
|
||||
{
|
||||
else if (service == "pushsafer")
|
||||
{
|
||||
if (options["secret"] == "")
|
||||
{
|
||||
PutModule("Error: secret (authorization token) not set");
|
||||
return;
|
||||
}
|
||||
{
|
||||
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")
|
||||
{
|
||||
if (options["secret"] == "")
|
||||
{
|
||||
PutModule("Error: secret (authorization token) not set");
|
||||
return;
|
||||
}
|
||||
|
||||
service_host = "pushalot.com";
|
||||
service_url = "/api/sendmessage";
|
||||
|
@ -428,16 +463,15 @@ class CPushMod : public CModule
|
|||
params["Body"] = message_content;
|
||||
|
||||
if (message_uri != "")
|
||||
{
|
||||
params["Link"] = message_uri;
|
||||
}
|
||||
|
||||
if ( options["message_uri_title"] != "" )
|
||||
{
|
||||
params["LinkTitle"] = options["message_uri_title"];
|
||||
}
|
||||
}
|
||||
{
|
||||
params["Link"] = message_uri;
|
||||
}
|
||||
|
||||
if (options["message_uri_title"] != "" )
|
||||
{
|
||||
params["LinkTitle"] = options["message_uri_title"];
|
||||
}
|
||||
}
|
||||
else if (service == "prowl")
|
||||
{
|
||||
if (options["secret"] == "")
|
||||
|
@ -503,31 +537,30 @@ class CPushMod : public CModule
|
|||
}
|
||||
else if (service == "nexmo")
|
||||
{
|
||||
if (options["username"] == "")
|
||||
{
|
||||
PutModule("Error: username (api key) not set");
|
||||
return;
|
||||
}
|
||||
if (options["secret"] == "")
|
||||
{
|
||||
PutModule("Error: secret (api secret) not set");
|
||||
return;
|
||||
}
|
||||
if (options["target"] == "")
|
||||
{
|
||||
PutModule("Error: destination mobile number (in international format) not set");
|
||||
return;
|
||||
}
|
||||
if (options["username"] == "")
|
||||
{
|
||||
PutModule("Error: username (api key) not set");
|
||||
return;
|
||||
}
|
||||
if (options["secret"] == "")
|
||||
{
|
||||
PutModule("Error: secret (api secret) not set");
|
||||
return;
|
||||
}
|
||||
if (options["target"] == "")
|
||||
{
|
||||
PutModule("Error: destination mobile number (in international format) not set");
|
||||
return;
|
||||
}
|
||||
|
||||
service_host = "rest.nexmo.com";
|
||||
service_url = "/sms/json";
|
||||
|
||||
params["api_secret"] = options["secret"];
|
||||
params["api_key"] = options["username"];
|
||||
params["from"] = message_title;
|
||||
params["to"] = options["target"];
|
||||
params["text"] = message_content;
|
||||
service_host = "rest.nexmo.com";
|
||||
service_url = "/sms/json";
|
||||
|
||||
params["api_secret"] = options["secret"];
|
||||
params["api_key"] = options["username"];
|
||||
params["from"] = message_title;
|
||||
params["to"] = options["target"];
|
||||
params["text"] = message_content;
|
||||
}
|
||||
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");
|
||||
}
|
||||
else if (value == "pushsafer")
|
||||
{
|
||||
PutModule("Note: Pushsafer requires setting the 'private or alias key' option");
|
||||
}
|
||||
else if (value == "pushalot")
|
||||
{
|
||||
{
|
||||
PutModule("Note: Pushalot requires setting the 'secret' (to user key) (to authorization token) option");
|
||||
}
|
||||
|
||||
}
|
||||
else if (value == "prowl")
|
||||
{
|
||||
PutModule("Note: Prowl requires setting the 'secret' option");
|
||||
|
|
Loading…
Reference in New Issue