mirror of https://github.com/SeanOMik/znc-push.git
commit
3e13fe55f9
|
@ -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"
|
||||
|
|
48
push.cpp
48
push.cpp
|
@ -76,13 +76,13 @@ class CPushMod : public CModule
|
|||
CString app;
|
||||
|
||||
// Time last notification was sent for a given context
|
||||
std::map <CString, unsigned int> last_notification_time;
|
||||
std::map <CString, unsigned int> last_notification_time;
|
||||
|
||||
// Time of last message by user to a given context
|
||||
std::map <CString, unsigned int> last_reply_time;
|
||||
std::map <CString, unsigned int> last_reply_time;
|
||||
|
||||
// Time of last activity by user for a given context
|
||||
std::map <CString, unsigned int> last_active_time;
|
||||
std::map <CString, unsigned int> last_active_time;
|
||||
|
||||
// Time of last activity by user in any context
|
||||
unsigned int idle_time;
|
||||
|
@ -129,7 +129,7 @@ class CPushMod : public CModule
|
|||
defaults["nick_blacklist"] = "";
|
||||
defaults["replied"] = "yes";
|
||||
|
||||
// Advanced
|
||||
// Advanced
|
||||
defaults["channel_conditions"] = "all";
|
||||
defaults["query_conditions"] = "all";
|
||||
defaults["debug"] = "off";
|
||||
|
@ -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"] == "")
|
||||
|
@ -310,20 +330,20 @@ class CPushMod : public CModule
|
|||
params["url"] = message_uri;
|
||||
}
|
||||
|
||||
if ( options["message_uri_title"] != "" )
|
||||
{
|
||||
params["url_title"] = options["message_uri_title"];
|
||||
}
|
||||
if ( options["message_uri_title"] != "" )
|
||||
{
|
||||
params["url_title"] = options["message_uri_title"];
|
||||
}
|
||||
|
||||
if (options["target"] != "")
|
||||
{
|
||||
params["device"] = options["target"];
|
||||
}
|
||||
|
||||
if ( options["message_sound"] != "" )
|
||||
{
|
||||
params["sound"] = options["message_sound"];
|
||||
}
|
||||
if ( options["message_sound"] != "" )
|
||||
{
|
||||
params["sound"] = options["message_sound"];
|
||||
}
|
||||
|
||||
if (options["message_priority"] != "")
|
||||
{
|
||||
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue