comparison libpurple/protocols/yahoo/yahoo.c @ 27166:76dda72a443b

Fix another small leak. And update formatting of some code for readability.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 24 Jun 2009 08:10:30 +0000
parents 2967cea30d8b
children e3150217e1b4
comparison
equal deleted inserted replaced
27165:1a971a264c3e 27166:76dda72a443b
330 if(f && strtol(pair->value, NULL, 10)) 330 if(f && strtol(pair->value, NULL, 10))
331 f->version_id = strtol(pair->value, NULL, 10); 331 f->version_id = strtol(pair->value, NULL, 10);
332 break; 332 break;
333 case 241: /* protocol buddy belongs to */ 333 case 241: /* protocol buddy belongs to */
334 if(strtol(pair->value, NULL, 10) == 2) { 334 if(strtol(pair->value, NULL, 10) == 2) {
335 g_free(msn_name);
335 msn_name = g_strconcat("msn/", name, NULL); 336 msn_name = g_strconcat("msn/", name, NULL);
336 name = msn_name; 337 name = msn_name;
337 } 338 }
338 break; 339 break;
339 default: 340 default:
348 if (message && f) 349 if (message && f)
349 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); 350 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode));
350 351
351 if (name && f) /* update the last buddy */ 352 if (name && f) /* update the last buddy */
352 yahoo_update_status(gc, name, f); 353 yahoo_update_status(gc, name, f);
354 g_free(msn_name);
353 } 355 }
354 356
355 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) 357 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group)
356 { 358 {
357 PurpleBuddy *b; 359 PurpleBuddy *b;
498 f = yahoo_friend_find_or_new(gc, norm_bud); 500 f = yahoo_friend_find_or_new(gc, norm_bud);
499 if (!(b = purple_find_buddy(account, norm_bud))) { 501 if (!(b = purple_find_buddy(account, norm_bud))) {
500 if (!(g = purple_find_group(yd->current_list15_grp))) { 502 if (!(g = purple_find_group(yd->current_list15_grp))) {
501 g = purple_group_new(yd->current_list15_grp); 503 g = purple_group_new(yd->current_list15_grp);
502 purple_blist_add_group(g, NULL); 504 purple_blist_add_group(g, NULL);
505 }
506 b = purple_buddy_new(account, norm_bud, NULL);
507 purple_blist_add_buddy(b, NULL, g, NULL);
503 } 508 }
504 b = purple_buddy_new(account, norm_bud, NULL); 509 yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp);
505 purple_blist_add_buddy(b, NULL, g, NULL); 510 if(protocol != 0) {
506 } 511 f->protocol = protocol;
507 yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp); 512 purple_debug_info("yahoo", "Setting protocol to %d\n", f->protocol);
508 if(protocol != 0) { 513 }
509 f->protocol = protocol; 514 if(stealth == 2)
510 purple_debug_info("yahoo", "Setting protocol to %d\n", f->protocol); 515 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
511 } 516
512 if(stealth == 2) 517 /* set p2p status not connected and no p2p packet sent */
513 f->presence = YAHOO_PRESENCE_PERM_OFFLINE; 518 if(protocol == 0) {
514 519 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED);
515 /* set p2p status not connected and no p2p packet sent */ 520 f->p2p_packet_sent = 0;
516 if(protocol == 0) { 521 } else
517 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); 522 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT);
518 f->p2p_packet_sent = 0;
519 } else
520 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT);
521 } else { 523 } else {
522 /* This buddy is on the ignore list (and therefore in no group) */ 524 /* This buddy is on the ignore list (and therefore in no group) */
523 purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); 525 purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud);
524 purple_privacy_deny_add(account, norm_bud, 1); 526 purple_privacy_deny_add(account, norm_bud, 1);
525 } 527 }