# HG changeset patch # User Christian Hammond # Date 1085645051 0 # Node ID 97a1fb329cd2ac116efe72cfbff3abc399854aab # Parent cab225a333b5d7e74698b503d69734d7c90488d0 [gaim-migrate @ 9868] Patch by Felipe Contreras (shx) to check first if we have a buddy already in a group before trying to add it to the group. committer: Tailor Script diff -r cab225a333b5 -r 97a1fb329cd2 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Thu May 27 08:02:43 2004 +0000 +++ b/src/protocols/msn/msn.c Thu May 27 08:04:11 2004 +0000 @@ -737,20 +737,31 @@ return; } + if (group != NULL) + msn_group = msn_groups_find_with_name(session->groups, group->name); + + /* We should check if the user isn't alredy there. */ for (l = session->lists.forward; l != NULL; l = l->next) { MsnUser *user = l->data; if (!gaim_utf8_strcasecmp(who, msn_user_get_passport(user))) - break; + { + if (group == NULL) + break; + else if (msn_group != NULL) + { + /* Now we should check if it's in the group. */ + if (g_list_find(user->group_ids, + GINT_TO_POINTER(msn_group->id))) + break; + } + } } if (l != NULL) return; - if (group != NULL) - msn_group = msn_groups_find_with_name(session->groups, group->name); - if (msn_group != NULL) { msn_cmdproc_send(cmdproc, "ADD", "FL %s %s %d", who, who, @@ -768,6 +779,7 @@ MsnSession *session; MsnCmdProc *cmdproc; MsnGroup *group; + GSList *l; session = gc->proto_data; cmdproc = session->notification_conn->cmdproc; @@ -780,6 +792,28 @@ group = msn_groups_find_with_name(session->groups, group_name); + /* We should check if the user is there. */ + for (l = session->lists.forward; l != NULL; l = l->next) + { + MsnUser *user = l->data; + + if (!gaim_utf8_strcasecmp(who, msn_user_get_passport(user))) + { + if (group_name == NULL) + break; + else if (group != NULL) + { + /* Now we should check if it's in the group. */ + if (g_list_find(user->group_ids, + GINT_TO_POINTER(group->id))) + break; + } + } + } + + if (l == NULL) + return; + if (group == NULL) { msn_cmdproc_send(cmdproc, "REM", "FL %s", who);