From 5f919beaa313e155337b3ec806ee8628579bfe90 Mon Sep 17 00:00:00 2001 From: Ryan Collins Date: Wed, 23 Apr 2014 09:49:48 -0400 Subject: [PATCH] Added Boxcar 2 support --- README.md | 7 +++++-- push.cpp | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d3df44..7967700 100755 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ services for any private message or channel highlight that matches a configurabl conditions. ZNC Push current supports the following services: * [Boxcar][] +* [Boxcar 2][] * [Notify My Android][] (NMA) * [Pushover][] * [Prowl][] @@ -292,8 +293,9 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or * `message_sound = ""` Notification sound to play with the push notification. - Currently only supported by Pushover.net. Must be chosen from their list of - [supported sounds](https://pushover.net/api#sounds). + 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). ### Conditions @@ -426,6 +428,7 @@ This project is licensed under the MIT license. See the `LICENSE` file for deta [Boxcar]: http://boxcar.io +[Boxcar 2]: http://boxcar.io [Notify My Android]: http://www.notifymyandroid.com [Pushover]: http://pushover.net [Prowl]: http://www.prowlapp.com diff --git a/push.cpp b/push.cpp index ee3915f..664e5fa 100755 --- a/push.cpp +++ b/push.cpp @@ -302,6 +302,25 @@ class CPushMod : public CModule params["notification[message]"] = message_content; params["notification[source_url]"] = message_uri; } + else if (service == "boxcar2") + { + if (options["secret"] == "") + { + PutModule("Error: secret not set to apikey"); + return; + } + + service_host = "new.boxcar.io"; + service_url = "/api/notifications"; + + params["user_credentials"] = options["secret"]; + params["notification[title]"] = message_title; + params["notification[long_message]"] = message_content; + if ( options["message_sound"] != "" ) + { + params["notification[sound]"] = options["message_sound"]; + } + } else if (service == "nma") { if (options["secret"] == "") @@ -1129,6 +1148,10 @@ class CPushMod : public CModule { PutModule("Note: Boxcar requires setting the 'username' option"); } + else if (value == "boxcar2") + { + PutModule("Note: Boxcar 2 requires setting the 'secret' option"); + } else if (value == "nma") { PutModule("Note: NMA requires setting the 'secret' option");