changeset 158:ae09f0d93b17

fixed a bug that get_status_with_api() will never be called if pidgin-twitter started with api_based_post disabled. it must be submitted to main loop regardless of configuration.
author Yoshiki Yazawa <yaz@honeyplnaet.jp>
date Sat, 26 Jul 2008 03:46:23 +0900
parents fbe526b20885
children b771ddf0b683
files pidgin-twitter.c
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Sat Jul 26 01:18:24 2008 +0900
+++ b/pidgin-twitter.c	Sat Jul 26 03:46:23 2008 +0900
@@ -513,9 +513,9 @@
 
     twitter_debug("called\n");
 
-    PurpleConversation *conv = (PurpleConversation *)data;
-    if(!conv)
-        return FALSE; /* cease fetch */
+    /* if disabled, just return */
+    if(!purple_prefs_get_bool(OPT_API_BASE_POST))
+        return TRUE;
 
     const char *screen_name =
         purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER);
@@ -1420,13 +1420,11 @@
     /* only attach to twitter conversation window */
     switch(service) {
     case twitter_service:
-        if(purple_prefs_get_bool(OPT_API_BASE_POST)) {
-            get_status_with_api((gpointer)conv);
-            source.id = g_timeout_add_seconds(
-                purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL),
-                get_status_with_api, (gpointer)conv);
-            source.conv = conv;
-        }
+        get_status_with_api((gpointer)conv);
+        source.id = g_timeout_add_seconds(
+            purple_prefs_get_int(OPT_API_BASE_GET_INTERVAL),
+            get_status_with_api, (gpointer)conv);
+        source.conv = conv;
         attach_to_conv(conv, NULL);
         break;
     case wassr_service:
@@ -2314,6 +2312,7 @@
                  gpointer data)
 {
     signed_on_cb(NULL);
+    get_status_with_api((gpointer)(source.conv));
 }
 
 
@@ -2647,7 +2646,6 @@
                                  purple_prefs_get_bool(OPT_API_BASE_POST));
     g_signal_connect(e, "toggled",
                      G_CALLBACK(bool_toggled_cb), &e);
-
     purple_prefs_connect_callback(plugin, OPT_API_BASE_POST, /* xxx divide? */
                                   api_base_post_cb, NULL);