Package: pidgin-libnotify
Version: 0.14-5+b1
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

Upon receiving a new chat message, pidgin-libnotify checks whether my nick is 
present in the message body
and only then lets the notification popup to be displayed. This is useful in 
chatrooms with many
participants and high message traffic, buy might not be desirable in every 
usage scenario.

As I often miss important messages because of this feature, I would really like 
to make it optional.

Attached patch adds to the plugin two new configuration options, one for 
disabling the check-for-a-nick and
second allowing to separately disable all notifications for chat messages, as 
there was no such option before
(as a counterpart for disabling IM notifications).

Default values of both switches are set so that there will be no changes in 
behavior of existing
installations, until user explicitly modifies the settings.

--- System information. ---
Architecture: amd64
Kernel:       Linux 3.0.0-1-amd64

Debian Release: wheezy/sid
  500 unstable        ftp.cz.debian.org
  500 unstable        emdebian.org
  500 testing         www.debian-multimedia.org
  500 testing         security.debian.org
  500 testing         ftp.cz.debian.org
    1 experimental    ftp.debian.org

--- Package information. ---
Depends                  (Version) | Installed
==================================-+-============
libatk1.0-0            (>= 1.12.4) | 2.0.1-2
libc6                   (>= 2.2.5) | 2.13-16
libcairo2               (>= 1.2.4) | 1.10.2-6.1
libfontconfig1          (>= 2.8.0) | 2.8.0-3
libfreetype6            (>= 2.2.1) | 2.4.6-1
libgdk-pixbuf2.0-0     (>= 2.22.0) | 2.23.5-3
libglib2.0-0           (>= 2.16.0) | 2.28.6-1
libgtk2.0-0             (>= 2.8.0) | 2.24.4-3
libnotify4              (>= 0.7.0) | 0.7.3-2
libpango1.0-0          (>= 1.14.0) | 1.28.4-1
pidgin                    (<< 3.0) | 2.9.0-3
pidgin                    (>= 2.9) | 2.9.0-3


Package's Recommends field is empty.

Package's Suggests field is empty.



From: Jakub Adam <jakub.a...@ktknet.cz>
Date: Sat, 20 Aug 2011 22:16:09 +0200
Subject: chat-nick-test-optional.diff

Made check for nick in chat message optional

Signed-off-by: Jakub Adam <jakub.a...@ktknet.cz>
---
 src/pidgin-libnotify.c |   44 +++++++++++++++++++++++++++++++-------------
 1 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/src/pidgin-libnotify.c b/src/pidgin-libnotify.c
index ab166d1..3317610 100644
--- a/src/pidgin-libnotify.c
+++ b/src/pidgin-libnotify.c
@@ -58,7 +58,17 @@ get_plugin_pref_frame (PurplePlugin *plugin)
 
 	ppref = purple_plugin_pref_new_with_name_and_label (
                             "/plugins/gtk/libnotify/newmsg",
-                            _("New messages"));
+                            _("New IM messages"));
+	purple_plugin_pref_frame_add (frame, ppref);
+
+	ppref = purple_plugin_pref_new_with_name_and_label (
+							"/plugins/gtk/libnotify/newchat",
+							_("New chat messages"));
+	purple_plugin_pref_frame_add (frame, ppref);
+
+	ppref = purple_plugin_pref_new_with_name_and_label (
+							"/plugins/gtk/libnotify/chat_check_nick",
+							_("Notify chat only when someone says my username"));
 	purple_plugin_pref_frame_add (frame, ppref);
 
 	ppref = purple_plugin_pref_new_with_name_and_label (
@@ -466,20 +476,26 @@ notify_new_message_cb (PurpleAccount *account,
 }
 
 static void
-notify_chat_nick (PurpleAccount *account,
-				  const gchar *sender,
-				  const gchar *message,
-				  PurpleConversation *conv,
-				  gpointer data)
+notify_new_chat_cb (PurpleAccount *account,
+					const gchar *sender,
+					const gchar *message,
+					PurpleConversation *conv,
+					gpointer data)
 {
-	gchar *nick;
 
-	nick = (gchar *)purple_conv_chat_get_nick (PURPLE_CONV_CHAT(conv));
-	if (nick && !strcmp (sender, nick))
+	if (!purple_prefs_get_bool ("/plugins/gtk/libnotify/newchat"))
 		return;
 
-	if (!g_strstr_len (message, strlen(message), nick))
-		return;
+	if (purple_prefs_get_bool ("/plugins/gtk/libnotify/chat_check_nick")) {
+		gchar *nick;
+
+		nick = (gchar *)purple_conv_chat_get_nick (PURPLE_CONV_CHAT(conv));
+		if (nick && !strcmp (sender, nick))
+			return;
+
+		if (!g_strstr_len (message, strlen(message), nick))
+			return;
+	}
 
 	notify_msg_sent (account, sender, message);
 }
@@ -510,7 +526,7 @@ plugin_load (PurplePlugin *plugin)
 						PURPLE_CALLBACK(notify_new_message_cb), NULL);
 
 	purple_signal_connect (conv_handle, "received-chat-msg", plugin,
-						PURPLE_CALLBACK(notify_chat_nick), NULL);
+						PURPLE_CALLBACK(notify_new_chat_cb), NULL);
 
 	/* used just to not display the flood of guifications we'd get */
 	purple_signal_connect (conn_handle, "signed-on", plugin,
@@ -538,7 +554,7 @@ plugin_unload (PurplePlugin *plugin)
 							PURPLE_CALLBACK(notify_new_message_cb));
 
 	purple_signal_disconnect (conv_handle, "received-chat-msg", plugin,
-							PURPLE_CALLBACK(notify_chat_nick));
+							PURPLE_CALLBACK(notify_new_chat_cb));
 
 	purple_signal_disconnect (conn_handle, "signed-on", plugin,
 							PURPLE_CALLBACK(event_connection_throttle));
@@ -595,6 +611,8 @@ init_plugin (PurplePlugin *plugin)
 
 	purple_prefs_add_none ("/plugins/gtk/libnotify");
 	purple_prefs_add_bool ("/plugins/gtk/libnotify/newmsg", TRUE);
+	purple_prefs_add_bool ("/plugins/gtk/libnotify/newchat", TRUE);
+	purple_prefs_add_bool ("/plugins/gtk/libnotify/chat_check_nick", TRUE);
 	purple_prefs_add_bool ("/plugins/gtk/libnotify/blocked", TRUE);
 	purple_prefs_add_bool ("/plugins/gtk/libnotify/newconvonly", FALSE);
 	purple_prefs_add_bool ("/plugins/gtk/libnotify/signon", TRUE);
-- 

Reply via email to