diff pidgin-twitter.c @ 214:148fa8a8be8e

- trying a new way to suppress window blinking in WIN32 - tweaked prefs.ui
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 26 Aug 2008 18:56:06 +0900
parents 8670e1572be8
children 6b258bdd9c49
line wrap: on
line diff
--- a/pidgin-twitter.c	Mon Aug 25 21:47:51 2008 +0900
+++ b/pidgin-twitter.c	Tue Aug 26 18:56:06 2008 +0900
@@ -34,6 +34,10 @@
 static GList *postedlist = NULL;
 static gchar *wassr_post = NULL;
 static gchar *identica_post = NULL;
+#ifdef _WIN32
+static gboolean blink_state = FALSE;
+static gboolean blink_modified = FALSE;
+#endif
 
 static struct _source {
     guint id;
@@ -494,6 +498,17 @@
     if(doc == NULL)
         return;
 
+#ifdef _WIN32
+    /* suppress notification of incoming messages. */
+    if(purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) {
+        if(!blink_modified) {
+            blink_modified = TRUE;
+            blink_state = purple_prefs_get_bool(OPT_PIDGIN_BLINK_IM);
+            purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, FALSE);
+        }
+    }
+#endif
+
      for(nptr = doc->children; nptr != NULL; nptr = nptr->next) {
         if(nptr->type == XML_ELEMENT_NODE &&
            !xmlStrcmp(nptr->name, (xmlChar *)"statuses")) {
@@ -1551,7 +1566,7 @@
             twitter_debug("candidate = %s\n", *candidate);
             if(!strcmp(user, *candidate)) {
                 twitter_debug("match. filter %s\n", user);
-                *flags |= PURPLE_MESSAGE_INVISIBLE; /* pidgin should handle this flag properly --yaz */
+//                *flags |= PURPLE_MESSAGE_INVISIBLE; /* pidgin should handle this flag properly --yaz */
 #if 1
                 /* temporal workaround */
                 g_free(*sender); *sender = NULL;
@@ -1579,10 +1594,23 @@
 
     gint service = get_service_type(conv);
 
+#ifdef _WIN32
     /* suppress notification of incoming messages. */
     if(service != unknown_service &&
-       purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION))
-        *flags |= PURPLE_MESSAGE_SYSTEM;
+       purple_prefs_get_bool(OPT_PREVENT_NOTIFICATION)) {
+        if(!blink_modified) {
+            blink_modified = TRUE;
+            blink_state = purple_prefs_get_bool(OPT_PIDGIN_BLINK_IM);
+            purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, FALSE);
+        }
+    }
+    else {
+        if(blink_modified) {
+            purple_prefs_set_bool(OPT_PIDGIN_BLINK_IM, blink_state);
+            blink_modified = FALSE;
+        }
+    }
+#endif
 
     if(service == wassr_service) {
         /* suppress annoying completion message from wassr */