comparison src/protocols/yahoo/yahoo.c @ 12203:0aeda1869b32

[gaim-migrate @ 14505] (20:07:48) Bleeter : This patch does the following: 1. Reduce the 'custom default' Yahoo statuses to those found in YIM6 2. Allows long server side presence lists to be processed 3. Remove idle reporting from tooltip, as this is now handled by gtkblist committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 24 Nov 2005 01:12:03 +0000
parents cda86ce5b026
children d345299ff3bc
comparison
equal deleted inserted replaced
12202:17be9401e167 12203:0aeda1869b32
487 char **lines; 487 char **lines;
488 char **split; 488 char **split;
489 char **buddies; 489 char **buddies;
490 char **tmp, **bud, *norm_bud; 490 char **tmp, **bud, *norm_bud;
491 char *grp = NULL; 491 char *grp = NULL;
492 char *perm_presence_buddies = NULL;
493 492
494 if (pkt->id) 493 if (pkt->id)
495 yd->session_id = pkt->id; 494 yd->session_id = pkt->id;
496 495
497 while (l) { 496 while (l) {
513 break; 512 break;
514 case 59: /* cookies, yum */ 513 case 59: /* cookies, yum */
515 yahoo_process_cookie(yd, pair->value); 514 yahoo_process_cookie(yd, pair->value);
516 break; 515 break;
517 case YAHOO_SERVICE_PRESENCE_PERM: 516 case YAHOO_SERVICE_PRESENCE_PERM:
518 perm_presence_buddies = pair->value; 517 if (!yd->tmp_serv_plist)
518 yd->tmp_serv_plist = g_string_new(pair->value);
519 else
520 g_string_append(yd->tmp_serv_plist, pair->value);
519 break; 521 break;
520 } 522 }
521 } 523 }
522 524
523 if (pkt->status != 0) 525 if (pkt->status != 0)
587 gc->account->perm_deny = GAIM_PRIVACY_DENY_USERS; 589 gc->account->perm_deny = GAIM_PRIVACY_DENY_USERS;
588 gaim_debug_info("yahoo", "%s privacy defaulting to GAIM_PRIVACY_DENY_USERS.\n", 590 gaim_debug_info("yahoo", "%s privacy defaulting to GAIM_PRIVACY_DENY_USERS.\n",
589 gc->account->username); 591 gc->account->username);
590 } 592 }
591 593
592 if (perm_presence_buddies) { 594 if (yd->tmp_serv_plist) {
593 buddies = g_strsplit(perm_presence_buddies, ",", -1); 595 buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1);
594 for (bud = buddies; bud && *bud; bud++) { 596 for (bud = buddies; bud && *bud; bud++) {
595 f = yahoo_friend_find(gc, *bud); 597 f = yahoo_friend_find(gc, *bud);
596 if (f) { 598 if (f) {
597 gaim_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", 599 gaim_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n",
598 gc->account->username, *bud); 600 gc->account->username, *bud);
599 f->presence = YAHOO_PRESENCE_PERM_OFFLINE; 601 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
600 } 602 }
601 } 603 }
602 g_strfreev(buddies); 604 g_strfreev(buddies);
605 g_string_free(yd->tmp_serv_plist, TRUE);
606 yd->tmp_serv_plist = NULL;
603 607
604 } 608 }
605 } 609 }
606 610
607 static void yahoo_process_notify(GaimConnection *gc, struct yahoo_packet *pkt) 611 static void yahoo_process_notify(GaimConnection *gc, struct yahoo_packet *pkt)
2625 } 2629 }
2626 2630
2627 static char *yahoo_get_status_string(enum yahoo_status a) 2631 static char *yahoo_get_status_string(enum yahoo_status a)
2628 { 2632 {
2629 switch (a) { 2633 switch (a) {
2634 case YAHOO_STATUS_BUSY:
2635 return _("Busy");
2636 case YAHOO_STATUS_STEPPEDOUT:
2637 return _("Stepped Out");
2630 case YAHOO_STATUS_BRB: 2638 case YAHOO_STATUS_BRB:
2631 return _("Be Right Back"); 2639 return _("Be Right Back");
2632 case YAHOO_STATUS_BUSY:
2633 return _("Busy");
2634 case YAHOO_STATUS_NOTATHOME:
2635 return _("Not At Home");
2636 case YAHOO_STATUS_NOTATDESK: 2640 case YAHOO_STATUS_NOTATDESK:
2637 return _("Not At Desk"); 2641 return _("Not At Desk");
2638 case YAHOO_STATUS_NOTINOFFICE:
2639 return _("Not In Office");
2640 case YAHOO_STATUS_ONPHONE: 2642 case YAHOO_STATUS_ONPHONE:
2641 return _("On The Phone"); 2643 return _("On The Phone");
2642 case YAHOO_STATUS_ONVACATION:
2643 return _("On Vacation");
2644 case YAHOO_STATUS_OUTTOLUNCH:
2645 return _("Out To Lunch");
2646 case YAHOO_STATUS_STEPPEDOUT:
2647 return _("Stepped Out");
2648 case YAHOO_STATUS_INVISIBLE: 2644 case YAHOO_STATUS_INVISIBLE:
2649 return _("Invisible"); 2645 return _("Invisible");
2650 case YAHOO_STATUS_IDLE: 2646 case YAHOO_STATUS_IDLE:
2651 return _("Idle"); 2647 return _("Idle");
2652 case YAHOO_STATUS_OFFLINE: 2648 case YAHOO_STATUS_OFFLINE:
2767 f = yahoo_friend_find(b->account->gc, b->name); 2763 f = yahoo_friend_find(b->account->gc, b->name);
2768 if (!f) 2764 if (!f)
2769 status = g_strdup_printf("\n%s", _("Not on server list")); 2765 status = g_strdup_printf("\n%s", _("Not on server list"));
2770 else { 2766 else {
2771 switch (f->status) { 2767 switch (f->status) {
2772 case YAHOO_STATUS_IDLE:
2773 if (f->idle == -1) {
2774 status = g_strdup(yahoo_get_status_string(f->status));
2775 break;
2776 }
2777 return NULL;
2778 case YAHOO_STATUS_CUSTOM: 2768 case YAHOO_STATUS_CUSTOM:
2779 if (!yahoo_friend_get_status_message(f)) 2769 if (!yahoo_friend_get_status_message(f))
2780 return NULL; 2770 return NULL;
2781 status = g_strdup(yahoo_friend_get_status_message(f)); 2771 status = g_strdup(yahoo_friend_get_status_message(f));
2782 break; 2772 break;
3209 _("Away"), TRUE, TRUE, FALSE, 3199 _("Away"), TRUE, TRUE, FALSE,
3210 "message", _("Message"), 3200 "message", _("Message"),
3211 gaim_value_new(GAIM_TYPE_STRING), NULL); 3201 gaim_value_new(GAIM_TYPE_STRING), NULL);
3212 types = g_list_append(types, type); 3202 types = g_list_append(types, type);
3213 3203
3204 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE);
3205 types = g_list_append(types, type);
3206
3207 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE);
3208 types = g_list_append(types, type);
3209
3214 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE); 3210 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE);
3215 types = g_list_append(types, type); 3211 types = g_list_append(types, type);
3216 3212
3217 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE);
3218 types = g_list_append(types, type);
3219
3220 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not At Home"), TRUE);
3221 types = g_list_append(types, type);
3222
3223 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not At Desk"), TRUE); 3213 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not At Desk"), TRUE);
3224 types = g_list_append(types, type); 3214 types = g_list_append(types, type);
3225 3215
3226 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not In Office"), TRUE);
3227 types = g_list_append(types, type);
3228
3229 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_ONPHONE, _("On The Phone"), TRUE); 3216 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_ONPHONE, _("On The Phone"), TRUE);
3230 types = g_list_append(types, type);
3231
3232 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE);
3233 types = g_list_append(types, type);
3234
3235 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out To Lunch"), TRUE);
3236 types = g_list_append(types, type);
3237
3238 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE);
3239 types = g_list_append(types, type); 3217 types = g_list_append(types, type);
3240 3218
3241 type = gaim_status_type_new(GAIM_STATUS_HIDDEN, YAHOO_STATUS_TYPE_INVISIBLE, _("Invisible"), TRUE); 3219 type = gaim_status_type_new(GAIM_STATUS_HIDDEN, YAHOO_STATUS_TYPE_INVISIBLE, _("Invisible"), TRUE);
3242 types = g_list_append(types, type); 3220 types = g_list_append(types, type);
3243 3221