changeset 205:bc1448e72b1b

workaround for that wassr sometimes provides 128 pixel icon with broad white borders.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 14 Aug 2008 16:20:22 +0900
parents d66ad3343119
children 99c4946e8449
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Wed Aug 13 15:51:23 2008 +0900
+++ b/pidgin-twitter.c	Thu Aug 14 16:20:22 2008 +0900
@@ -24,7 +24,7 @@
 /***********/
 /* globals */
 /***********/
-#define NUM_REGPS 12
+#define NUM_REGPS 13
 #define NUM_SERVICES 3          /* twitter, wassr, identica. */
 static GRegex *regp[NUM_REGPS];
 static gboolean suppress_oops = FALSE;
@@ -1807,7 +1807,12 @@
         tmp = g_strdup_printf("%s/%s", url,
                               purple_url_encode(slash+1));
     else if(service == wassr_service) {
-        tmp = g_strdup_printf("http://wassr.jp%s/%s", url, slash+1);
+        gchar *tmp0 = NULL;
+        tmp0 = g_regex_replace(regp[SIZE_128_WASSR], slash+1,
+                                     -1, 0, ".64.", 0, NULL);
+        tmp = g_strdup_printf("http://wassr.jp%s/%s", url,
+                              tmp0 ? tmp0 : slash+1);
+        g_free(tmp0);
     }
     else {
         tmp = g_strdup_printf("%s/%s", url, slash+1);
@@ -2425,6 +2430,7 @@
     regp[IMAGE_WASSR]    = g_regex_new(P_IMAGE_WASSR, 0, 0, NULL);
     regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL);
     regp[TAG_IDENTICA]   = g_regex_new(P_TAG_IDENTICA, 0, 0, NULL);
+    regp[SIZE_128_WASSR] = g_regex_new(P_SIZE_128_WASSR, 0, 0, NULL);
 
     for(i = twitter_service; i < NUM_SERVICES; i++) {
         icon_hash[i] = g_hash_table_new_full(g_str_hash, g_str_equal,
--- a/pidgin-twitter.h	Wed Aug 13 15:51:23 2008 +0900
+++ b/pidgin-twitter.h	Thu Aug 14 16:20:22 2008 +0900
@@ -37,7 +37,8 @@
     IMAGE_TWITTER,
     IMAGE_WASSR,
     IMAGE_IDENTICA,
-    TAG_IDENTICA
+    TAG_IDENTICA,
+    SIZE_128_WASSR
 };
 
 /* service id */
@@ -149,7 +150,7 @@
 #define P_IMAGE_WASSR       "<div class=\"image\"><a href=\".+\"><img src=\"(.+)\" width=\".+?\" /></a></div>"
 #define P_IMAGE_IDENTICA    "<img src=\"(http://avatar.identi.ca/[A-Za-z0-9-.]+)\" class=\"avatar profile\" width=\"96\" height=\"96\" alt=\"[A-Za-z0-0_]+\"/>"
 #define P_TAG_IDENTICA      "#([A-Za-z0-9]+)"
-
+#define P_SIZE_128_WASSR    "\\.128\\."
 
 /* twitter API specific macros */
 #define TWITTER_BASE_URL "http://twitter.com"