Merge pull request #35 from alok0/master

Support for PushBullet
This commit is contained in:
John Reese 2013-05-09 21:01:13 -07:00
commit 3e13fe55f9
2 changed files with 41 additions and 13 deletions

View File

@ -11,6 +11,7 @@ conditions. ZNC Push current supports the following services:
* [Pushover][]
* [Prowl][]
* [Supertoasty][]
* [PushBullet][]
* Custom URL GET requests
This project is still a Work In Progress, but should be functional enough and stable enough
@ -190,6 +191,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* "pushover"
* "prowl"
* "supertoasty"
* "pushbullet"
* "url"
* `username = ""`
@ -202,7 +204,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 Notifo, Notify My Android, Pushover, Prowl or Supertoasty.
This option must be set when using Notifo, Notify My Android, Pushover, Prowl, Supertoasty or PushBullet.
* `target = ""`
@ -211,6 +213,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
When using Pushover, this option allows you to specify a single device name to send
notifications to; if blank or unset, notifications will be sent to all devices.
This option must be set when using PushBullet.
### Notifications
@ -391,6 +394,7 @@ This project is licensed under the MIT license. See the `LICENSE` file for deta
[Pushover]: http://pushover.net
[Prowl]: http://www.prowlapp.com
[Supertoasty]: http://www.supertoasty.com
[PushBullet]: https://www.pushbullet.com/
[issues]: http://github.com/jreese/znc-push/issues
[ZNC]: http://en.znc.in "ZNC, an advanced IRC bouncer"

View File

@ -251,6 +251,26 @@ class CPushMod : public CModule
params["title"] = message_title;
params["uri"] = message_uri;
}
else if (service == "pushbullet")
{
if (options["target"] == "" || options["secret"] == "")
{
PutModule("Error: target (device id) or secret (api key) not set");
return;
}
service_host = "www.pushbullet.com";
service_url = "/api/pushes";
// BASIC auth, base64-encoded APIKey:
service_auth = options["secret"] + CString(":");
service_auth.Base64Encode();
params["device_id"] = options["target"];
params["type"] = "note";
params["title"] = message_title;
params["body"] = message_content;
}
else if (service == "boxcar")
{
if (options["username"] == "")
@ -1039,6 +1059,10 @@ class CPushMod : public CModule
{
PutModule("Note: Notifo requires setting both 'username' and 'secret' options");
}
else if (value == "pushbullet")
{
PutModule("Note: Pushbullet requires setting both 'target' (to device id) and 'secret' (to api key) options");
}
else if (value == "boxcar")
{
PutModule("Note: Boxcar requires setting the 'username' option");