Merge pull request #258 from mcrute/add-igloo

Add Igloo push support
This commit is contained in:
John Reese 2021-05-03 17:57:52 -07:00 committed by GitHub
commit 7f5529cde2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 5 deletions

View File

@ -25,6 +25,7 @@ conditions. ZNC Push current supports the following services:
* [Telegram][] * [Telegram][]
* [Slack][] * [Slack][]
* [Discord][] * [Discord][]
* [Igloo][]
* 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
@ -252,6 +253,7 @@ to something similar to "http://domain/#channel/2011-03-09 14:25:09", or
* `telegram` * `telegram`
* `slack` * `slack`
* `discord` * `discord`
* `igloo`
* `url` * `url`
* `username` Default: ` ` * `username` Default: ` `
@ -549,6 +551,7 @@ from me and not from my employer. See the `LICENSE` file for details.
[Telegram]: https://telegram.org/ [Telegram]: https://telegram.org/
[Slack]: https://slack.com/ [Slack]: https://slack.com/
[Discord]: https://discord.gg [Discord]: https://discord.gg
[Igloo]: https://iglooirc.com/
[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

@ -229,7 +229,7 @@ class CPushMod : public CModule
* @param title Message title to use * @param title Message title to use
* @param context Channel or nick context * @param context Channel or nick context
*/ */
void send_message(const CString& message, const CString& title="New Message", const CString& context="*push", const CNick& nick=CString("*push")) void send_message(const CString& message, const CString& title="New Message", const CString& context="*push", const CNick& nick=CString("*push"), const CString& type="")
{ {
// Set the last notification time // Set the last notification time
last_notification_time[context] = time(NULL); last_notification_time[context] = time(NULL);
@ -483,6 +483,29 @@ class CPushMod : public CModule
params["description"] = message_content; params["description"] = message_content;
params["url"] = message_uri; params["url"] = message_uri;
} }
else if (service == "igloo")
{
if (options["target"] == "")
{
PutModule("Error: no devices are set");
return;
}
service_host = "api.iglooirc.com";
service_url = "/znc/push";
if (network != NULL)
{
params["network"] = network->GetName();
params["nick"] = network->GetNick();
}
params["sender"] = nick.GetNick();
params["channel"] = context;
params["message"] = message;
params["type"] = type;
params["device1"] = options["target"];
}
else if (service == "supertoasty") else if (service == "supertoasty")
{ {
if (options["secret"] == "") if (options["secret"] == "")
@ -1234,7 +1257,7 @@ class CPushMod : public CModule
{ {
CString title = "Highlight"; CString title = "Highlight";
send_message(message, title, channel.GetName(), nick); send_message(message, title, channel.GetName(), nick, "action");
} }
return CONTINUE; return CONTINUE;
@ -1253,7 +1276,7 @@ class CPushMod : public CModule
{ {
CString title = "Channel Notice"; CString title = "Channel Notice";
send_message(message, title, channel.GetName(), nick); send_message(message, title, channel.GetName(), nick, "notice");
} }
return CONTINUE; return CONTINUE;
@ -1289,7 +1312,7 @@ class CPushMod : public CModule
{ {
CString title = "Private Message"; CString title = "Private Message";
send_message(message, title, nick.GetNick(), nick); send_message(message, title, nick.GetNick(), nick, "action");
} }
return CONTINUE; return CONTINUE;
@ -1307,7 +1330,7 @@ class CPushMod : public CModule
{ {
CString title = "Private Notice"; CString title = "Private Notice";
send_message(message, title, nick.GetNick(), nick); send_message(message, title, nick.GetNick(), nick, "notice");
} }
return CONTINUE; return CONTINUE;
@ -1473,6 +1496,10 @@ class CPushMod : public CModule
{ {
PutModule("Note: Prowl requires setting the 'secret' option"); PutModule("Note: Prowl requires setting the 'secret' option");
} }
else if (value == "igloo")
{
PutModule("Note: Igloo requires adding your device with 'target'");
}
else if (value == "supertoasty") else if (value == "supertoasty")
{ {
PutModule("Note: Supertoasty requires setting the 'secret' option with device id"); PutModule("Note: Supertoasty requires setting the 'secret' option with device id");