changeset 160:aef26b56a54b

now it falls back to twitter default icon if the user has not set custom icon.
author Yoshiki Yazawa <yaz@honeyplnaet.jp>
date Sat, 26 Jul 2008 13:23:27 +0900
parents b771ddf0b683
children 5dcd8699cba0
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Sat Jul 26 04:47:47 2008 +0900
+++ b/pidgin-twitter.c	Sat Jul 26 13:23:27 2008 +0900
@@ -1733,22 +1733,30 @@
         return;
     }
 
-    /* setup image url */
+    /* setup image url */ /* xxx need simplify --yaz */
     g_regex_match(regp[regp_id], url_text, 0, &match_info);
     if(!g_match_info_matches(match_info)) {
-        twitter_debug("no image url found\n");
-
         g_match_info_free(match_info);
-        if(data) {
-            data->requested = FALSE;
-            data->fetch_data = NULL;
+
+        if(service == twitter_service) {
+            twitter_debug("fall back to twitter default icon\n");
+            url = g_strdup(TWITTER_DEFAULT_ICON_URL);
         }
-        g_free(gotdata->user_name);
-        g_free(gotdata);
-        return;
+        else {
+            twitter_debug("no image url found\n");
+            if(data) {
+                data->requested = FALSE;
+                data->fetch_data = NULL;
+            }
+            g_free(gotdata->user_name);
+            g_free(gotdata);
+            return;
+        }
     }
-    url = g_match_info_fetch(match_info, 1);
-    g_match_info_free(match_info);
+    else {
+        url = g_match_info_fetch(match_info, 1);
+        g_match_info_free(match_info);
+    }
 
     gchar *slash = strrchr(url, '/');
     *slash = '\0';
@@ -1770,7 +1778,7 @@
     g_free(url);
     url = tmp;
 
-    twitter_debug("requested_url=%s\n", url);
+    twitter_debug("requested url=%s\n", url);
 
     /* request fetch image */
     if(url) {
--- a/pidgin-twitter.h	Sat Jul 26 04:47:47 2008 +0900
+++ b/pidgin-twitter.h	Sat Jul 26 13:23:27 2008 +0900
@@ -156,6 +156,7 @@
 #define TWITTER_STATUS_FORMAT "status=%s"
 #define TWITTER_STATUS_TERMINATOR "\r\n\r\n"
 #define TWITTER_DEFAULT_INTERVAL (60)
+#define TWITTER_DEFAULT_ICON_URL "http://static.twitter.com/images/default_profile_bigger.png"
 
 /* wassr specific macros */
 #define WASSR_POST_LEN (255 * 4)