changeset 19783:c590e780b3a0

[gaim-migrate @ 17055] fix bug on group management committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sun, 27 Aug 2006 08:03:32 +0000
parents e45fae8209c3
children 3b971c87279d
files src/protocols/msn/dialog.c src/protocols/msn/session.c src/protocols/msn/user.c
diffstat 3 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/dialog.c	Sat Aug 26 13:03:11 2006 +0000
+++ b/src/protocols/msn/dialog.c	Sun Aug 27 08:03:32 2006 +0000
@@ -114,10 +114,11 @@
 	if (group_name != NULL)
 		group = gaim_find_group(group_name);
 
-	if (group != NULL)
+	if (group != NULL){
 		buddy = gaim_find_buddy_in_group(account, passport, group);
-	else
+	}else{
 		buddy = gaim_find_buddy(account, passport);
+	}
 
 	if (buddy != NULL)
 		gaim_blist_remove_buddy(buddy);
--- a/src/protocols/msn/session.c	Sat Aug 26 13:03:11 2006 +0000
+++ b/src/protocols/msn/session.c	Sun Aug 27 08:03:32 2006 +0000
@@ -270,7 +270,8 @@
 
 	/* 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. */
+	 * over the whole buddy list to identify sync issues. 
+	 */
 	for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next){
 		GaimGroup *group = (GaimGroup *)gnode;
 		const char *group_name = group->name;
@@ -299,13 +300,16 @@
 						const char *group_id;
 						GList *l;
 
+						gaim_debug_info("MaYuan","remote user:{%s}\n",b->name);
 						group_id = msn_userlist_find_group_id(remote_user->userlist,
 								group_name);
 						if(group_id == NULL){
 							continue;
 						}
+						gaim_debug_info("MaYuan","group_id:{%s}\n",group_id);
 
 						for (l = remote_user->group_ids; l != NULL; l = l->next){
+							gaim_debug_info("MaYuan","l->data:{%s}\n",l->data);
 							if (!g_strcasecmp(group_id ,l->data)){
 								found = TRUE;
 								break;
--- a/src/protocols/msn/user.c	Sat Aug 26 13:03:11 2006 +0000
+++ b/src/protocols/msn/user.c	Sun Aug 27 08:03:32 2006 +0000
@@ -60,8 +60,13 @@
 	if (user->clientcaps != NULL)
 		g_hash_table_destroy(user->clientcaps);
 
-	if (user->group_ids != NULL)
+	if (user->group_ids != NULL){
+		GList *l;
+		for (l = user->group_ids; l != NULL; l = l->next){
+			g_free(l->data);
+		}
 		g_list_free(user->group_ids);
+	}
 
 	if (user->msnobj != NULL)
 		msn_object_destroy(user->msnobj);
@@ -265,20 +270,22 @@
 	GaimBuddy *b;
 	GaimGroup *g;
 	const char *passport;
+	const char *group_id;
 	const char *group_name;
 
 	g_return_if_fail(user != NULL);
 	g_return_if_fail(id != NULL);
 
-	user->group_ids = g_list_append(user->group_ids,id);
+	group_id = g_strdup(id);
+	user->group_ids = g_list_append(user->group_ids,group_id);
 
 	userlist = user->userlist;
 	account = userlist->session->account;
 	passport = msn_user_get_passport(user);
 
-	group_name = msn_userlist_find_group_name(userlist, id);
+	group_name = msn_userlist_find_group_name(userlist, group_id);
 
-	gaim_debug_info("User","group id:%s,name:%s,user:%s\n",id,group_name,passport);
+	gaim_debug_info("User","group id:%s,name:%s,user:%s\n",group_id,group_name,passport);
 
 	g = gaim_find_group(group_name);
 
@@ -315,6 +322,7 @@
 	g_return_if_fail(id != NULL);
 
 	user->group_ids = g_list_remove(user->group_ids, id);
+	g_free(id);
 }
 
 void