Mercurial > pidgin
changeset 9091:97a1fb329cd2
[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 <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 27 May 2004 08:04:11 +0000 |
parents | cab225a333b5 |
children | 9e5a709c30a8 |
files | src/protocols/msn/msn.c |
diffstat | 1 files changed, 38 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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);