Fix #4: Add support for Pushover service

This commit is contained in:
John Reese 2012-07-23 22:07:28 -07:00
parent 9761c72b82
commit 58e24cf331
2 changed files with 27 additions and 1 deletions

View File

@ -8,6 +8,7 @@ conditions. ZNC Push current supports the following services:
* [Boxcar][] * [Boxcar][]
* [Notifo][] * [Notifo][]
* [Notify My Android][] (NMA) * [Notify My Android][] (NMA)
* [Pushover][]
* [Prowl][] * [Prowl][]
* [Supertoasty][] * [Supertoasty][]
@ -160,6 +161,7 @@ Configuration
* "boxcar" * "boxcar"
* "notifo" * "notifo"
* "nma" * "nma"
* "pushover"
* "prowl" * "prowl"
* "supertoasty" * "supertoasty"
@ -173,7 +175,7 @@ Configuration
Authentication token for push notifications. Authentication token for push notifications.
This option must be set when using Notifo, Notify My Android, Prowl or Supertoasty. This option must be set when using Notifo, Notify My Android, Pushover, Prowl or Supertoasty.
### Conditions ### Conditions
@ -340,6 +342,7 @@ This project is licensed under the MIT license. See the `LICENSE` file for deta
[Boxcar]: http://boxcar.io [Boxcar]: http://boxcar.io
[Notifo]: http://notifo.com [Notifo]: http://notifo.com
[Notify My Android]: http://www.notifymyandroid.com [Notify My Android]: http://www.notifymyandroid.com
[Pushover]: http://pushover.net
[Prowl]: http://www.prowlapp.com [Prowl]: http://www.prowlapp.com
[Supertoasty]: http://www.supertoasty.com [Supertoasty]: http://www.supertoasty.com

View File

@ -283,6 +283,25 @@ class CPushMod : public CModule
params["description"] = short_message; params["description"] = short_message;
params["url"] = uri; params["url"] = uri;
} }
else if (service == "pushover")
{
if (options["secret"] == "")
{
PutModule("Error: secret (user key) not set");
return;
}
CString pushover_api_token = "h6RToHDU7gNnB3IMyUb94SuwKtBzOD";
service_host = "api.pushover.net";
service_url = "/1/messages.json";
params["token"] = pushover_api_token;
params["user"] = options["secret"];
//params["device"] = short_message;
params["title"] = title;
params["message"] = short_message;
}
else if (service == "prowl") else if (service == "prowl")
{ {
if (options["secret"] == "") if (options["secret"] == "")
@ -917,6 +936,10 @@ class CPushMod : public CModule
{ {
PutModule("Note: NMA requires setting the 'secret' option"); PutModule("Note: NMA requires setting the 'secret' option");
} }
else if (value == "pushover")
{
PutModule("Note: Pushover requires setting the 'secret' 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");