comparison icon.c @ 300:42cdddf0f747

added preliminary support for friendfeed.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 25 May 2009 22:47:44 +0900
parents add1e454b87f
children bc7d8baf79dd
comparison
equal deleted inserted replaced
299:d68ed289ef69 300:42cdddf0f747
68 switch(service) { 68 switch(service) {
69 case twitter_service: 69 case twitter_service:
70 case wassr_service: 70 case wassr_service:
71 case identica_service: 71 case identica_service:
72 case jisko_service: 72 case jisko_service:
73 case ffeed_service:
73 hash = icon_hash[service]; 74 hash = icon_hash[service];
74 break; 75 break;
75 default: 76 default:
76 twitter_debug("unknown service\n"); 77 twitter_debug("unknown service\n");
77 } 78 }
110 switch(service) { 111 switch(service) {
111 case twitter_service: 112 case twitter_service:
112 case wassr_service: 113 case wassr_service:
113 case identica_service: 114 case identica_service:
114 case jisko_service: 115 case jisko_service:
116 case ffeed_service:
115 hash = icon_hash[service]; 117 hash = icon_hash[service];
116 break; 118 break;
117 default: 119 default:
118 twitter_debug("unknown service\n"); 120 twitter_debug("unknown service\n");
119 break; 121 break;
177 else if(service == jisko_service) { 179 else if(service == jisko_service) {
178 data = (icon_data *)g_hash_table_lookup( 180 data = (icon_data *)g_hash_table_lookup(
179 icon_hash[service], user_name); 181 icon_hash[service], user_name);
180 regp_id = IMAGE_JISKO; 182 regp_id = IMAGE_JISKO;
181 } 183 }
184 else if(service == ffeed_service) {
185 data = (icon_data *)g_hash_table_lookup(
186 icon_hash[service], user_name);
187 regp_id = IMAGE_FFEED;
188 }
182 189
183 /* retrieved nothing or got a bad response */ 190 /* retrieved nothing or got a bad response */
184 if(!url_text || 191 if(!url_text ||
185 (!strstr(url_text, "HTTP/1.1 200 OK") && 192 (!strstr(url_text, "HTTP/1.1 200 OK") &&
186 !strstr(url_text, "HTTP/1.0 200 OK"))) { 193 !strstr(url_text, "HTTP/1.0 200 OK"))) {
210 } 217 }
211 else if(service == jisko_service) { 218 else if(service == jisko_service) {
212 twitter_debug("fall back to jisko default icon: %s\n", 219 twitter_debug("fall back to jisko default icon: %s\n",
213 gotdata->user_name); 220 gotdata->user_name);
214 url = g_strdup(JISKO_DEFAULT_ICON_URL); 221 url = g_strdup(JISKO_DEFAULT_ICON_URL);
222 }
223 else if(service == ffeed_service) {
224 twitter_debug("fall back to ffeed default icon: %s\n",
225 gotdata->user_name);
226 url = g_strdup(FFEED_DEFAULT_ICON_URL);
215 } 227 }
216 else { 228 else {
217 twitter_debug("no image url found\n"); 229 twitter_debug("no image url found\n");
218 if(data) { 230 if(data) {
219 data->requested = FALSE; 231 data->requested = FALSE;
354 switch(service) { 366 switch(service) {
355 case twitter_service: 367 case twitter_service:
356 case wassr_service: 368 case wassr_service:
357 case identica_service: 369 case identica_service:
358 case jisko_service: 370 case jisko_service:
371 case ffeed_service:
359 hash = icon_hash[service]; 372 hash = icon_hash[service];
360 break; 373 break;
361 default: 374 default:
362 twitter_debug("unknown service\n"); 375 twitter_debug("unknown service\n");
363 } 376 }
410 case identica_service: 423 case identica_service:
411 url = IDENTICA_DEFAULT_ICON_URL; 424 url = IDENTICA_DEFAULT_ICON_URL;
412 break; 425 break;
413 case jisko_service: 426 case jisko_service:
414 url = JISKO_DEFAULT_ICON_URL; 427 url = JISKO_DEFAULT_ICON_URL;
428 case ffeed_service:
429 url = FFEED_DEFAULT_ICON_URL;
415 break; 430 break;
416 } 431 }
417 432
418 g_free(data->icon_url); 433 g_free(data->icon_url);
419 data->icon_url = g_strdup(url); 434 data->icon_url = g_strdup(url);
468 suffix = "identica"; 483 suffix = "identica";
469 break; 484 break;
470 case jisko_service: 485 case jisko_service:
471 suffix = "jisko"; 486 suffix = "jisko";
472 break; 487 break;
488 case ffeed_service:
489 suffix = "ffeed";
490 break;
473 default: 491 default:
474 twitter_debug("unknown service\n"); 492 twitter_debug("unknown service\n");
475 break; 493 break;
476 } 494 }
477 495
535 suffix = "identica"; 553 suffix = "identica";
536 break; 554 break;
537 case jisko_service: 555 case jisko_service:
538 hash = icon_hash[service]; 556 hash = icon_hash[service];
539 suffix = "jisko"; 557 suffix = "jisko";
558 break;
559 case ffeed_service:
560 hash = icon_hash[service];
561 suffix = "ffeed";
540 break; 562 break;
541 default: 563 default:
542 twitter_debug("unknown service\n"); 564 twitter_debug("unknown service\n");
543 break; 565 break;
544 } 566 }
628 url = g_strdup_printf("http://identi.ca/%s/avatar/96", user_name); 650 url = g_strdup_printf("http://identi.ca/%s/avatar/96", user_name);
629 break; 651 break;
630 case jisko_service: 652 case jisko_service:
631 url = g_strdup_printf("http://jisko.net/%s", user_name); 653 url = g_strdup_printf("http://jisko.net/%s", user_name);
632 break; 654 break;
655 case ffeed_service:
656 url = g_strdup_printf("http://friendfeed.com/%s", user_name);
657 break;
633 default: 658 default:
634 twitter_debug("unknown service\n"); 659 twitter_debug("unknown service\n");
635 break; 660 break;
636 } 661 }
637 662
641 gotdata->service = service; 666 gotdata->service = service;
642 667
643 /* gotdata will be released in got_icon_cb */ 668 /* gotdata will be released in got_icon_cb */
644 if(service == twitter_service || 669 if(service == twitter_service ||
645 service == wassr_service || 670 service == wassr_service ||
646 service == jisko_service) { 671 service == jisko_service ||
672 service == ffeed_service) {
647 data->fetch_data = 673 data->fetch_data =
648 purple_util_fetch_url_request(url, TRUE, NULL, TRUE, NULL, 674 purple_util_fetch_url_request(url, TRUE, NULL, TRUE, NULL,
649 TRUE, got_page_cb, gotdata); 675 TRUE, got_page_cb, gotdata);
650 } 676 }
651 else { /* typically, identica_service */ 677 else { /* typically, identica_service */
678 hash = icon_hash[identica_service]; 704 hash = icon_hash[identica_service];
679 break; 705 break;
680 case jisko_service: 706 case jisko_service:
681 hash = icon_hash[jisko_service]; 707 hash = icon_hash[jisko_service];
682 break; 708 break;
709 case ffeed_service:
710 hash = icon_hash[ffeed_service];
711 break;
683 default: 712 default:
684 twitter_debug("unknown service\n"); 713 twitter_debug("unknown service\n");
685 break; 714 break;
686 } 715 }
687 716