changeset 59:3f9148c1dc60

added that to prevent notifications of incoming messages from twitter.com.
author mikanbako <maoutwo@gmail.com>
date Thu, 22 May 2008 21:59:49 +0900
parents 31374ae054b0
children ddd164e74312
files pidgin-twitter.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Sat May 17 21:05:12 2008 +0900
+++ b/pidgin-twitter.c	Thu May 22 21:59:49 2008 +0900
@@ -52,6 +52,7 @@
 #define OPT_USERLIST_SENDER     OPT_PIDGINTWITTER "/userlist_sender"
 #define OPT_COUNTER             OPT_PIDGINTWITTER "/counter"
 #define OPT_SUPPRESS_OOPS       OPT_PIDGINTWITTER "/suppress_oops"
+#define OPT_PREVENT_NOTIFICATION OPT_PIDGINTWITTER "/prevent_notification"
 
 /* formats and templates */
 #define RECIPIENT_FORMAT        "@<a href='http://twitter.com/%s'>%s</a>"
@@ -681,6 +682,15 @@
     twitter_debug("called\n");
     twitter_debug("buffer = %s suppress_oops = %d\n", *buffer, suppress_oops);
 
+    /* Prevent notifications of incoming messages.
+     * Check that conv is not null to avoid a clash.
+     * conv is null when the conversation window has not opened yet.
+     */
+    if(conv && is_twitter_conv(conv) &&
+       purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) {
+        *flags |= PURPLE_MESSAGE_SYSTEM;
+    }
+
     if(!suppress_oops || !purple_prefs_get_bool(OPT_SUPPRESS_OOPS))
         return FALSE;
 
@@ -881,6 +891,17 @@
 
     purple_plugin_pref_frame_add(frame, pref);
 
+    /************************/
+    /* notification heading */
+    /************************/
+    pref = purple_plugin_pref_new_with_label("Notification Configuration");
+    purple_plugin_pref_frame_add(frame, pref);
+
+    /* notification setting */
+    pref = purple_plugin_pref_new_with_name_and_label(OPT_PREVENT_NOTIFICATION,
+                                "Prevent notifications of incoming messages");
+    purple_plugin_pref_frame_add(frame, pref);
+
     return frame;
 }
 
@@ -933,6 +954,8 @@
 
     purple_prefs_add_bool(OPT_COUNTER, TRUE);
     purple_prefs_add_bool(OPT_SUPPRESS_OOPS, TRUE);
+
+    purple_prefs_add_bool(OPT_PREVENT_NOTIFICATION, FALSE);
 }
 
 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info)