Mercurial > pidgin
diff src/protocols/msn/session.c @ 11992:c824e39db0e7
[gaim-migrate @ 14285]
- make Offline a user setable status in MSN
- redo MSN status changing to query the core for the current status instead
of keeping track of it itself, as recommended by Mark on patch #1336338.
- bring back the buddy list synchronization by parsing the buddy list after
signon
committer: Tailor Script <tailor@pidgin.im>
| author | Stu Tomlinson <stu@nosnilmot.com> |
|---|---|
| date | Sun, 06 Nov 2005 21:52:00 +0000 |
| parents | 10066662176a |
| children | 8872789902a1 |
line wrap: on
line diff
--- a/src/protocols/msn/session.c Sun Nov 06 19:52:20 2005 +0000 +++ b/src/protocols/msn/session.c Sun Nov 06 21:52:00 2005 +0000 @@ -39,7 +39,6 @@ session->account = account; session->notification = msn_notification_new(session); session->userlist = msn_userlist_new(session); - session->sync_userlist = msn_userlist_new(session); session->user = msn_user_new(session->userlist, gaim_account_get_username(account), NULL); @@ -71,9 +70,6 @@ msn_userlist_destroy(session->userlist); - if (session->sync_userlist != NULL) - msn_userlist_destroy(session->sync_userlist); - if (session->passport_info.kv != NULL) g_free(session->passport_info.kv); @@ -231,72 +227,63 @@ static void msn_session_sync_users(MsnSession *session) { - GList *l; - - l = session->sync_userlist->users; - - while (l != NULL) - { - MsnUser *local_user; + GaimBlistNode *gnode, *cnode, *bnode; + GaimConnection *gc = gaim_account_get_connection(session->account); - local_user = (MsnUser *)l->data; + g_return_if_fail(gc != NULL); - if (local_user->passport != NULL) - { - MsnUser *remote_user; - - remote_user = msn_userlist_find_user(session->userlist, - local_user->passport); + /* The core used to use msn_add_buddy to add all buddies before + * being logged in. This no longer happens, so we manually iterate + * over the whole buddy list to identify sync issues. */ - if (remote_user == NULL || - ((local_user->list_op & ( 1 << MSN_LIST_FL)) && - !(remote_user->list_op & ( 1 << MSN_LIST_FL)))) - { - /* The user was not on the server list */ - msn_show_sync_issue(session, local_user->passport, NULL); - } - else - { - GList *l; - - for (l = local_user->group_ids; l != NULL; l = l->next) - { - const char *group_name; - int gid; + for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { + GaimGroup *group = (GaimGroup *)gnode; + const char *group_name = group->name; + if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) + continue; + for(cnode = gnode->child; cnode; cnode = cnode->next) { + if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) + continue; + for(bnode = cnode->child; bnode; bnode = bnode->next) { + GaimBuddy *b; + if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) + continue; + b = (GaimBuddy *)bnode; + if(b->account == gc->account) { + MsnUser *remote_user; gboolean found = FALSE; - GList *l2; + + remote_user = msn_userlist_find_user(session->userlist, b->name); - group_name = - msn_userlist_find_group_name(local_user->userlist, - GPOINTER_TO_INT(l->data)); + if ((remote_user != NULL) && (remote_user->list_op & MSN_LIST_FL_OP)) + { + int group_id; + GList *l; - gid = msn_userlist_find_group_id(remote_user->userlist, - group_name); + group_id = msn_userlist_find_group_id(remote_user->userlist, + group_name); - for (l2 = remote_user->group_ids; l2 != NULL; l2 = l2->next) - { - if (GPOINTER_TO_INT(l2->data) == gid) + for (l = remote_user->group_ids; l != NULL; l = l->next) { - found = TRUE; - break; + if (group_id == GPOINTER_TO_INT(l->data)) + { + found = TRUE; + break; + } } + } if (!found) { - /* The user was not on that group on the server list */ - msn_show_sync_issue(session, local_user->passport, - group_name); + /* The user was not on the server list or not in that group + * on the server list */ + msn_show_sync_issue(session, b->name, group_name); } } } } - - l = l->next; } - - msn_userlist_destroy(session->sync_userlist); - session->sync_userlist = NULL; } void @@ -416,7 +403,7 @@ session->logged_in = TRUE; - msn_change_status(session, session->state == 0 ? MSN_ONLINE : session->state); + msn_change_status(session); gaim_connection_set_state(gc, GAIM_CONNECTED);
