Add Pushjet support

This commit is contained in:
shodan 2015-08-13 11:40:18 +02:00 committed by John Reese
parent 878af545ac
commit 769fb80c48
2 changed files with 76 additions and 44 deletions

View File

@ -22,6 +22,7 @@ conditions. ZNC Push current supports the following services:
* [Faast][] * [Faast][]
* [Nexmo][] * [Nexmo][]
* [Pushalot][] * [Pushalot][]
* [Pushjet][]
* Custom URL GET requests * Custom URL GET requests
This project is still a Work In Progress, but should be functional enough and stable enough This project is still a Work In Progress, but should be functional enough and stable enough
@ -241,6 +242,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* `pushbullet` * `pushbullet`
* `airgram` * `airgram`
* `nexmo` * `nexmo`
* `pushjet`
* `url` * `url`
* `username` Default: ` ` * `username` Default: ` `
@ -256,7 +258,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, Airgram authenticated services, PushBullet, or Nexmo. This option must be set when using Notify My Android, Pushover, Prowl, Supertoasty, Airgram authenticated services, PushBullet, Nexmo or Pushjet.
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.
@ -318,7 +320,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* `message_priority` Default: ` ` * `message_priority` Default: ` `
Priority level that will be used for the push notification. Priority level that will be used for the push notification.
Currently supported only by Pushover.net and Notify My Android. Currently supported only by Pushover.net, Notify My Android and Pushjet.
* `message_sound` Default: ` ` * `message_sound` Default: ` `
@ -525,6 +527,7 @@ from me and not from my employer. See the `LICENSE` file for details.
[Faast]: http://faast.io/ [Faast]: http://faast.io/
[Nexmo]: https://www.nexmo.com [Nexmo]: https://www.nexmo.com
[Pushalot]: https://pushalot.com/ [Pushalot]: https://pushalot.com/
[Pushjet]: http://pushjet.io
[faq]: https://github.com/jreese/znc-push/blob/master/doc/faq.md [faq]: https://github.com/jreese/znc-push/blob/master/doc/faq.md
[examples]: https://github.com/jreese/znc-push/blob/master/doc/examples.md [examples]: https://github.com/jreese/znc-push/blob/master/doc/examples.md

View File

@ -651,6 +651,31 @@ class CPushMod : public CModule
PutDebug("payload: " + params["payload"]); PutDebug("payload: " + params["payload"]);
} }
else if (service == "pushjet")
{
if (options["secret"] == "")
{
PutModule("Error: secret (service key) not set");
return;
}
service_host = "api.pushjet.io";
service_url = "/message";
params["secret"] = options["secret"];
params["title"] = message_title;
params["message"] = message_content;
if (message_uri != "")
{
params["link"] = message_uri;
}
if (options["message_priority"] != "")
{
params["level"] = options["message_priority"];
}
}
else else
{ {
PutModule("Error: service type not selected"); PutModule("Error: service type not selected");
@ -1384,6 +1409,10 @@ class CPushMod : public CModule
{ {
PutModule("Note: Slack requires setting 'secret' (from webhook) and 'target' (channel or username), optional 'username' (bot name)"); PutModule("Note: Slack requires setting 'secret' (from webhook) and 'target' (channel or username), optional 'username' (bot name)");
} }
else if (value == "pushjet")
{
PutModule("Note: Pushjet requires setting 'secret' (service key) option");
}
else else
{ {
PutModule("Error: unknown service name"); PutModule("Error: unknown service name");