comparison libpurple/protocols/yahoo/libymsg.c @ 30630:33989e3a449b

Minor cleanup
author Mark Doliner <mark@kingant.net>
date Thu, 17 Jun 2010 21:06:00 +0000
parents 50380b60aa56
children 509c63006b1f c4cbe5f992ce
comparison
equal deleted inserted replaced
30629:07f716427b50 30630:33989e3a449b
399 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) 399 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group)
400 { 400 {
401 PurpleBuddy *b; 401 PurpleBuddy *b;
402 PurpleGroup *g; 402 PurpleGroup *g;
403 GSList *list, *i; 403 GSList *list, *i;
404 gboolean onlist = 0; 404 gboolean onlist = FALSE;
405 char *oname = NULL; 405 char *oname;
406 char **oname_p = &oname; 406
407 GSList **list_p = &list; 407 if (g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *)&oname, (gpointer *)&list))
408 408 g_hash_table_steal(ht, oname);
409 if (!g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p)) 409 else
410 list = purple_find_buddies(account, name); 410 list = purple_find_buddies(account, name);
411 else
412 g_hash_table_steal(ht, name);
413 411
414 for (i = list; i; i = i->next) { 412 for (i = list; i; i = i->next) {
415 b = i->data; 413 b = i->data;
416 g = purple_buddy_get_group(b); 414 g = purple_buddy_get_group(b);
417 if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) { 415 if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) {
418 purple_debug_misc("yahoo", 416 purple_debug_misc("yahoo",
419 "Oh good, %s is in the right group (%s).\n", name, group); 417 "Oh good, %s is in the right group (%s).\n", name, group);
420 list = g_slist_delete_link(list, i); 418 list = g_slist_delete_link(list, i);
421 onlist = 1; 419 onlist = TRUE;
422 break; 420 break;
423 } 421 }
424 } 422 }
425 423
426 if (!onlist) { 424 if (!onlist) {
436 434
437 if (list) { 435 if (list) {
438 if (!oname) 436 if (!oname)
439 oname = g_strdup(purple_normalize(account, name)); 437 oname = g_strdup(purple_normalize(account, name));
440 g_hash_table_insert(ht, oname, list); 438 g_hash_table_insert(ht, oname, list);
441 } else if (oname) 439 } else
442 g_free(oname); 440 g_free(oname);
443 } 441 }
444 442
445 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) 443 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data)
446 { 444 {