comparison pidgin-twitter.c @ 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 0eac0abcc0aa
comparison
equal deleted inserted replaced
204:d66ad3343119 205:bc1448e72b1b
22 22
23 23
24 /***********/ 24 /***********/
25 /* globals */ 25 /* globals */
26 /***********/ 26 /***********/
27 #define NUM_REGPS 12 27 #define NUM_REGPS 13
28 #define NUM_SERVICES 3 /* twitter, wassr, identica. */ 28 #define NUM_SERVICES 3 /* twitter, wassr, identica. */
29 static GRegex *regp[NUM_REGPS]; 29 static GRegex *regp[NUM_REGPS];
30 static gboolean suppress_oops = FALSE; 30 static gboolean suppress_oops = FALSE;
31 static GHashTable *icon_hash[NUM_SERVICES]; 31 static GHashTable *icon_hash[NUM_SERVICES];
32 static GHashTable *conv_hash = NULL; 32 static GHashTable *conv_hash = NULL;
1805 /* url encode basename. twitter needs this. */ 1805 /* url encode basename. twitter needs this. */
1806 if(service == twitter_service) 1806 if(service == twitter_service)
1807 tmp = g_strdup_printf("%s/%s", url, 1807 tmp = g_strdup_printf("%s/%s", url,
1808 purple_url_encode(slash+1)); 1808 purple_url_encode(slash+1));
1809 else if(service == wassr_service) { 1809 else if(service == wassr_service) {
1810 tmp = g_strdup_printf("http://wassr.jp%s/%s", url, slash+1); 1810 gchar *tmp0 = NULL;
1811 tmp0 = g_regex_replace(regp[SIZE_128_WASSR], slash+1,
1812 -1, 0, ".64.", 0, NULL);
1813 tmp = g_strdup_printf("http://wassr.jp%s/%s", url,
1814 tmp0 ? tmp0 : slash+1);
1815 g_free(tmp0);
1811 } 1816 }
1812 else { 1817 else {
1813 tmp = g_strdup_printf("%s/%s", url, slash+1); 1818 tmp = g_strdup_printf("%s/%s", url, slash+1);
1814 } 1819 }
1815 1820
2423 regp[CHANNEL_WASSR] = g_regex_new(P_CHANNEL, 0, 0, NULL); 2428 regp[CHANNEL_WASSR] = g_regex_new(P_CHANNEL, 0, 0, NULL);
2424 regp[IMAGE_TWITTER] = g_regex_new(P_IMAGE_TWITTER, 0, 0, NULL); 2429 regp[IMAGE_TWITTER] = g_regex_new(P_IMAGE_TWITTER, 0, 0, NULL);
2425 regp[IMAGE_WASSR] = g_regex_new(P_IMAGE_WASSR, 0, 0, NULL); 2430 regp[IMAGE_WASSR] = g_regex_new(P_IMAGE_WASSR, 0, 0, NULL);
2426 regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL); 2431 regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL);
2427 regp[TAG_IDENTICA] = g_regex_new(P_TAG_IDENTICA, 0, 0, NULL); 2432 regp[TAG_IDENTICA] = g_regex_new(P_TAG_IDENTICA, 0, 0, NULL);
2433 regp[SIZE_128_WASSR] = g_regex_new(P_SIZE_128_WASSR, 0, 0, NULL);
2428 2434
2429 for(i = twitter_service; i < NUM_SERVICES; i++) { 2435 for(i = twitter_service; i < NUM_SERVICES; i++) {
2430 icon_hash[i] = g_hash_table_new_full(g_str_hash, g_str_equal, 2436 icon_hash[i] = g_hash_table_new_full(g_str_hash, g_str_equal,
2431 g_free, NULL); 2437 g_free, NULL);
2432 } 2438 }