summary refs log tree commit diff stats
path: root/src/fe-gtk/plugin-notification.c
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-05-27 20:39:07 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-05-27 20:39:07 -0300
commit5571d277b93b62c73568b78c652c85b2e8e95183 (patch)
tree0d97d65058e31ccdeab4006384442a8e378d5f06 /src/fe-gtk/plugin-notification.c
parentf58165fd33919951e2ca594c6f19a785420fc4f9 (diff)
parent7f8b0a19cff46f7d27451fb9942eea5018f0c5b5 (diff)
Merge upstream changes
Diffstat (limited to 'src/fe-gtk/plugin-notification.c')
-rw-r--r--src/fe-gtk/plugin-notification.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/fe-gtk/plugin-notification.c b/src/fe-gtk/plugin-notification.c
index 3ac89244..29478d7a 100644
--- a/src/fe-gtk/plugin-notification.c
+++ b/src/fe-gtk/plugin-notification.c
@@ -25,6 +25,9 @@
 
 static hexchat_plugin *ph;
 
+const int CHANNEL_FLAG_BALLOON       = 1 << 21;
+const int CHANNEL_FLAG_BALLOON_UNSET = 1 << 22;
+
 static gboolean
 should_alert (void)
 {
@@ -117,10 +120,24 @@ static int
 incoming_message_cb (char *word[], gpointer userdata)
 {
 	int message;
+	int flags;
+	int alert = 0;
+
+	flags = hexchat_list_int(ph, NULL, "flags");
+
+	/* Let sure that can alert */
+	if (should_alert()) {
+		/* Follow the channel rules if set */
+		if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) {
+			alert = (flags & CHANNEL_FLAG_BALLOON);
+		} else {
+			/* Else follow global environment */
+			alert = (hexchat_get_prefs(ph, "input_balloon_chans", NULL, &message) == 3 && message);
+		}
+	}
 
-	if (hexchat_get_prefs (ph, "input_balloon_chans", NULL, &message) == 3 && message && should_alert ())
-	{
-		show_notificationf (word[2], _("Channel message from: %s (%s)"), word[1], hexchat_get_info (ph, "channel"));
+	if (alert) {
+		show_notificationf(word[2], _("Channel message from: %s (%s)"), word[1], hexchat_get_info(ph, "channel"));
 	}
 	return HEXCHAT_EAT_NONE;
 }
@@ -129,8 +146,23 @@ static int
 incoming_priv_cb (char *word[], gpointer userdata)
 {
 	int priv;
+	int flags;
+	int alert = 0;
+
+	flags = hexchat_list_int(ph, NULL, "flags");
+
+	/* Let sure that can alert */
+	if (should_alert()) {
+		/* Follow the private rules if set */
+		if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) {
+			alert = (flags & CHANNEL_FLAG_BALLOON);
+		} else {
+			/* Else follow global environment */
+			alert = (hexchat_get_prefs(ph, "input_balloon_priv", NULL, &priv) == 3 && priv);
+		}
+	}
 
-	if (hexchat_get_prefs (ph, "input_balloon_priv", NULL, &priv) == 3 && priv && should_alert ())
+	if (alert)
 	{
 		const char *network = hexchat_get_info (ph, "network");
 		if (!network)