diff libgaim/protocols/msn/dialog.c @ 20390:d634f88e25d8

msn.tgz from SF Patch #1621854 from Ka-Hing Cheung "This tarball brings soc-2006-msnp13 up to head. In addition to that it also fixes a crash with sending offline messages. I wasn't able to generate a diff against that branch, svn seems to insist on diff'ing against HEAD after I run the merge command. After running `svn merge -r 16309:HEAD https://gaim.svn.sourceforge.net/svnroot/gaim/trunk` on the soc-2006-msnp13 you can replace the msn directory with the attached tarball. The fix for offline messaging is on msn.c:901: if (!session->oim) session->oim = msn_oim_new(session)" committer: Richard Laager <rlaager@wiktel.com>
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 15 Apr 2007 02:18:17 +0000
parents e354528c4163
children 9755b2f7bb0f
line wrap: on
line diff
--- a/libgaim/protocols/msn/dialog.c	Sun Apr 15 02:10:37 2007 +0000
+++ b/libgaim/protocols/msn/dialog.c	Sun Apr 15 02:18:17 2007 +0000
@@ -34,40 +34,20 @@
 
 } MsnAddRemData;
 
-/* Remove the buddy referenced by the MsnAddRemData before the serverside list is changed.
- * If the buddy will be added, he'll be added back; if he will be removed, he won't be. */
-static void
-msn_complete_sync_issue(MsnAddRemData *data)
-{
-	GaimBuddy *buddy;
-	GaimGroup *group = NULL;
-
-	if (data->group != NULL)
-		group = gaim_find_group(data->group);
-	
-	if (group != NULL)
-		buddy = gaim_find_buddy_in_group(gaim_connection_get_account(data->gc), data->who, group);
-	else
-		buddy = gaim_find_buddy(gaim_connection_get_account(data->gc), data->who);
-	
-	if (buddy != NULL)
-		gaim_blist_remove_buddy(buddy);
-}
-
 static void
 msn_add_cb(MsnAddRemData *data)
 {
-	MsnSession *session;
-	MsnUserList *userlist;
-
-	msn_complete_sync_issue(data);
+	if (g_list_find(gaim_connections_get_all(), data->gc) != NULL)
+	{
+		MsnSession *session = data->gc->proto_data;
+		MsnUserList *userlist = session->userlist;
 
-	session = data->gc->proto_data;
-	userlist = session->userlist;
+		msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group);
+	}
 
-	msn_userlist_add_buddy(userlist, data->who, MSN_LIST_FL, data->group);
+	if (data->group != NULL)
+		g_free(data->group);
 
-	g_free(data->group);
 	g_free(data->who);
 	g_free(data);
 }
@@ -75,17 +55,17 @@
 static void
 msn_rem_cb(MsnAddRemData *data)
 {
-	MsnSession *session;
-	MsnUserList *userlist;
-
-	msn_complete_sync_issue(data);
+	if (g_list_find(gaim_connections_get_all(), data->gc) != NULL)
+	{
+		MsnSession *session = data->gc->proto_data;
+		MsnUserList *userlist = session->userlist;
 
-	session = data->gc->proto_data;
-	userlist = session->userlist;
+		msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group);
+	}
 
-	msn_userlist_rem_buddy(userlist, data->who, MSN_LIST_FL, data->group);
+	if (data->group != NULL)
+		g_free(data->group);
 
-	g_free(data->group);
 	g_free(data->who);
 	g_free(data);
 }
@@ -113,16 +93,13 @@
 						  gaim_account_get_username(account),
 						  gaim_account_get_protocol_name(account));
 
-	if (group_name != NULL)
-	{
+	if (group_name != NULL){
 		reason = g_strdup_printf(_("%s on the local list is "
 								   "inside the group \"%s\" but not on "
 								   "the server list. "
 								   "Do you want this buddy to be added?"),
 								 passport, group_name);
-	}
-	else
-	{
+	}else{
 		reason = g_strdup_printf(_("%s is on the local list but "
 								   "not on the server list. "
 								   "Do you want this buddy to be added?"),
@@ -137,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);