Mercurial > pidgin.yaz
diff src/protocols/msn/notification.c @ 6767:926d539938ca
[gaim-migrate @ 7304]
MSN server-side buddy list now overrides local buddy list. This will most
likely result in misplaced buddies, but fixes several problems. I'm sure
the "My MSN buddies moved to a new group!!" bug reports are going to be
common.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 07 Sep 2003 01:06:09 +0000 |
parents | b7e113a59b51 |
children | e719379c8a79 |
line wrap: on
line diff
--- a/src/protocols/msn/notification.c Sat Sep 06 23:07:27 2003 +0000 +++ b/src/protocols/msn/notification.c Sun Sep 07 01:06:09 2003 +0000 @@ -38,6 +38,11 @@ /************************************************************************** * Utility functions **************************************************************************/ +static void +sync_groups_for_buddy(MsnServConn *servconn, MsnUser *user) +{ +} + static gboolean add_buddy(MsnServConn *servconn, MsnUser *user) { @@ -48,6 +53,7 @@ MsnGroup *group = NULL; GaimGroup *g = NULL; GList *l, *l2; + GSList *sl; GSList *buddies; buddies = gaim_find_buddies(account, msn_user_get_passport(user)); @@ -55,7 +61,6 @@ for (l = msn_user_get_group_ids(user); l != NULL; l = l->next) { int group_id = GPOINTER_TO_INT(l->data); - GSList *l3; if (group_id > -1) group = msn_groups_find_with_id(session->groups, group_id); @@ -91,9 +96,9 @@ b = NULL; - for (l3 = buddies; l3 != NULL; l3 = l3->next) + for (sl = buddies; sl != NULL; sl = sl->next) { - b = (GaimBuddy *)l3->data; + b = (GaimBuddy *)sl->data; if (gaim_find_buddys_group(b) == g) break; @@ -109,11 +114,22 @@ gaim_blist_add_buddy(b, NULL, g, NULL); } - gaim_debug(GAIM_DEBUG_INFO, "msn", - "Adding MsnUser to %s's proto_data (group %d, %s)\n", - b->name, group_id, (g == NULL ? "(null)" : g->name)); + b->proto_data = user; + } + + /* Find all occurrences of this buddy in the wrong place. */ + for (sl = buddies; sl != NULL; sl = sl->next) + { + b = sl->data; - b->proto_data = user; + if (b->proto_data == NULL) + { + gaim_debug_warning("msn", + "Deleting misplaced user %s (%s) during sync with server.\n", + b->name, gaim_find_buddys_group(b)->name); + + gaim_blist_remove_buddy(b); + } } g_slist_free(buddies); @@ -1146,12 +1162,11 @@ tokens = g_strsplit(group_nums, ",", -1); - gaim_debug(GAIM_DEBUG_MISC, "msn", - "Fetching group IDs from '%s'\n", group_nums); + gaim_debug_misc("msn", "Fetching group IDs from '%s'\n", + group_nums); for (c = tokens; *c != NULL; c++) { - gaim_debug(GAIM_DEBUG_MISC, "msn", - "Appending group ID %d\n", atoi(*c)); + gaim_debug_misc("msn", "Appending group ID %d\n", atoi(*c)); msn_user_add_group_id(user, atoi(*c)); }