1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-26 20:55:19 +03:00
aports/testing/znc-push/0001-Add-Igloo-push-support.patch
2021-05-03 22:50:50 +00:00

131 lines
4 KiB
Diff

From 9a23f6dfd05aa7b46c2ab9d2bcd68681a067f276 Mon Sep 17 00:00:00 2001
From: Mike Crute <mike@crute.us>
Date: Fri, 30 Apr 2021 00:06:37 +0000
Subject: [PATCH] Add Igloo push support
---
README.md | 3 +++
push.cpp | 37 ++++++++++++++++++++++++++++++++-----
2 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index f2905e1..57d02a4 100755
--- a/README.md
+++ b/README.md
@@ -25,6 +25,7 @@ conditions. ZNC Push current supports the following services:
* [Telegram][]
* [Slack][]
* [Discord][]
+* [Igloo][]
* Custom URL GET requests
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`
* `slack`
* `discord`
+ * `igloo`
* `url`
* `username` Default: ` `
@@ -549,6 +551,7 @@ from me and not from my employer. See the `LICENSE` file for details.
[Telegram]: https://telegram.org/
[Slack]: https://slack.com/
[Discord]: https://discord.gg
+[Igloo]: https://iglooirc.com/
[faq]: https://github.com/jreese/znc-push/blob/master/doc/faq.md
[examples]: https://github.com/jreese/znc-push/blob/master/doc/examples.md
diff --git a/push.cpp b/push.cpp
index f008229..9d08089 100755
--- a/push.cpp
+++ b/push.cpp
@@ -229,7 +229,7 @@ class CPushMod : public CModule
* @param title Message title to use
* @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
last_notification_time[context] = time(NULL);
@@ -483,6 +483,29 @@ class CPushMod : public CModule
params["description"] = message_content;
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")
{
if (options["secret"] == "")
@@ -1234,7 +1257,7 @@ class CPushMod : public CModule
{
CString title = "Highlight";
- send_message(message, title, channel.GetName(), nick);
+ send_message(message, title, channel.GetName(), nick, "action");
}
return CONTINUE;
@@ -1253,7 +1276,7 @@ class CPushMod : public CModule
{
CString title = "Channel Notice";
- send_message(message, title, channel.GetName(), nick);
+ send_message(message, title, channel.GetName(), nick, "notice");
}
return CONTINUE;
@@ -1289,7 +1312,7 @@ class CPushMod : public CModule
{
CString title = "Private Message";
- send_message(message, title, nick.GetNick(), nick);
+ send_message(message, title, nick.GetNick(), nick, "action");
}
return CONTINUE;
@@ -1307,7 +1330,7 @@ class CPushMod : public CModule
{
CString title = "Private Notice";
- send_message(message, title, nick.GetNick(), nick);
+ send_message(message, title, nick.GetNick(), nick, "notice");
}
return CONTINUE;
@@ -1473,6 +1496,10 @@ class CPushMod : public CModule
{
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")
{
PutModule("Note: Supertoasty requires setting the 'secret' option with device id");
--
2.19.2