changeset 20396:9755b2f7bb0f

Revert some whitespace changes.
author Richard Laager <rlaager@wiktel.com>
date Sun, 15 Apr 2007 02:42:11 +0000
parents d634f88e25d8
children 6ac7e33fdabf
files libgaim/protocols/msn/command.c libgaim/protocols/msn/dialog.c libgaim/protocols/msn/msn.c libgaim/protocols/msn/servconn.c libgaim/protocols/msn/session.c libgaim/protocols/msn/userlist.c
diffstat 6 files changed, 127 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/msn/command.c	Sun Apr 15 02:18:17 2007 +0000
+++ b/libgaim/protocols/msn/command.c	Sun Apr 15 02:42:11 2007 +0000
@@ -138,7 +138,9 @@
 		param = cmd->params[0];
 
 		cmd->trId = is_num(param) ? atoi(param) : 0;
-	}else{
+	}
+	else
+	{
 		cmd->trId = 0;
 	}
 
--- a/libgaim/protocols/msn/dialog.c	Sun Apr 15 02:18:17 2007 +0000
+++ b/libgaim/protocols/msn/dialog.c	Sun Apr 15 02:42:11 2007 +0000
@@ -45,9 +45,7 @@
 		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);
 }
@@ -63,9 +61,7 @@
 		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);
 }
@@ -93,13 +89,16 @@
 						  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?"),
@@ -114,11 +113,10 @@
 	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/libgaim/protocols/msn/msn.c	Sun Apr 15 02:18:17 2007 +0000
+++ b/libgaim/protocols/msn/msn.c	Sun Apr 15 02:42:11 2007 +0000
@@ -967,7 +967,8 @@
 
 	gc = gaim_account_get_connection(account);
 
-	if (gc != NULL){
+	if (gc != NULL)
+	{
 		session = gc->proto_data;
 		msn_change_status(session);
 	}
@@ -2108,10 +2109,10 @@
 	"MSN",                                            /**< name           */
 	VERSION,                                          /**< version        */
 	                                                  /**  summary        */
-	N_("Windows Live Messenger Protocol Plugin"),
+	N_("MSN Protocol Plugin"),
 	                                                  /**  description    */
-	N_("Windows Live Messenger Protocol Plugin"),
-	"MaYuan <mayuan2006@gmail.com>",				/**< author         */
+	N_("MSN Protocol Plugin"),
+	"Christian Hammond <chipx86@gnupdate.org>",	  /**< author         */
 	GAIM_WEBSITE,                                     /**< homepage       */
 
 	msn_load,                                         /**< load           */
--- a/libgaim/protocols/msn/servconn.c	Sun Apr 15 02:18:17 2007 +0000
+++ b/libgaim/protocols/msn/servconn.c	Sun Apr 15 02:42:11 2007 +0000
@@ -203,7 +203,6 @@
 msn_servconn_connect(MsnServConn *servconn, const char *host, int port)
 {
 	MsnSession *session;
-	int r;
 
 	g_return_val_if_fail(servconn != NULL, FALSE);
 	g_return_val_if_fail(host     != NULL, FALSE);
@@ -241,7 +240,9 @@
 	{
 		servconn->processing = TRUE;
 		return TRUE;
-	}else{
+	}
+	else
+	{
 		return FALSE;
 	}
 }
@@ -436,10 +437,13 @@
 
 		servconn->rx_len -= cur_len;
 
-		if (servconn->payload_len){
+		if (servconn->payload_len)
+		{
 			msn_cmdproc_process_payload(servconn->cmdproc, cur, cur_len);
 			servconn->payload_len = 0;
-		}else{
+		}
+		else
+		{
 			msn_cmdproc_process_cmd_text(servconn->cmdproc, cur);
 			servconn->payload_len = servconn->cmdproc->last_cmd->payload_len;
 		}
--- a/libgaim/protocols/msn/session.c	Sun Apr 15 02:18:17 2007 +0000
+++ b/libgaim/protocols/msn/session.c	Sun Apr 15 02:42:11 2007 +0000
@@ -42,6 +42,7 @@
 
 	session->user = msn_user_new(session->userlist,
 								 gaim_account_get_username(account), NULL);
+
 	session->bnode = NULL;
 	
 	/*if you want to chat with Yahoo Messenger*/
@@ -270,7 +271,13 @@
 
 	g_return_if_fail(gc != NULL);
 
-	for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next){
+	/* 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. */
+
+	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) {
@@ -357,9 +364,11 @@
 								break;
 							}
 						}
+
 					}
 
-					if (!found){
+					if (!found)
+					{
 						/* 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);
@@ -494,4 +503,3 @@
 	/* Sync users */
 	msn_session_sync_users(session);
 }
-
--- a/libgaim/protocols/msn/userlist.c	Sun Apr 15 02:18:17 2007 +0000
+++ b/libgaim/protocols/msn/userlist.c	Sun Apr 15 02:42:11 2007 +0000
@@ -222,11 +222,17 @@
 		}else{
 			/* session->sync->fl_users_count++; */
 		}
-	}else if (list_id == MSN_LIST_AL){
+	}
+	else if (list_id == MSN_LIST_AL)
+	{
 		gaim_privacy_permit_add(account, passport, TRUE);
-	}else if (list_id == MSN_LIST_BL){
+	}
+	else if (list_id == MSN_LIST_BL)
+	{
 		gaim_privacy_deny_add(account, passport, TRUE);
-	}else if (list_id == MSN_LIST_RL){
+	}
+	else if (list_id == MSN_LIST_RL)
+	{
 		GaimConnection *gc;
 		GaimConversation *convo;
 
@@ -275,19 +281,29 @@
 
 	passport = msn_user_get_passport(user);
 
-	if (list_id == MSN_LIST_FL){
+	if (list_id == MSN_LIST_FL)
+	{
 		/* TODO: When is the user totally removed? */
-		if (group_id != NULL){
+		if (group_id != NULL)
+		{
 			msn_user_remove_group_id(user, group_id);
 			return;
-		}else{
+		}
+		else
+		{
 			/* session->sync->fl_users_count--; */
 		}
-	}else if (list_id == MSN_LIST_AL){
+	}
+	else if (list_id == MSN_LIST_AL)
+	{
 		gaim_privacy_permit_remove(account, passport, TRUE);
-	}else if (list_id == MSN_LIST_BL){
+	}
+	else if (list_id == MSN_LIST_BL)
+	{
 		gaim_privacy_deny_remove(account, passport, TRUE);
-	}else if (list_id == MSN_LIST_RL){
+	}
+	else if (list_id == MSN_LIST_RL)
+	{
 		GaimConversation *convo;
 
 		gaim_debug_info("msn",
@@ -333,9 +349,11 @@
 	passport = msn_user_get_passport(user);
 	store = msn_user_get_store_name(user);
 
-	if (list_op & MSN_LIST_FL_OP){
+	if (list_op & MSN_LIST_FL_OP)
+	{
 		GSList *c;
-		for (c = group_ids; c != NULL; c = g_slist_next(c))	{
+		for (c = group_ids; c != NULL; c = g_slist_next(c))
+		{
 			char *group_id;
 			group_id = c->data;
 			msn_user_add_group_id(user, group_id);
@@ -346,19 +364,22 @@
 		serv_got_alias(gc, passport, store);
 	}
 
-	if (list_op & MSN_LIST_AL_OP){
+	if (list_op & MSN_LIST_AL_OP)
+	{
 		/* These are users who are allowed to see our status. */
 		gaim_privacy_deny_remove(account, passport, TRUE);
 		gaim_privacy_permit_add(account, passport, TRUE);
 	}
 
-	if (list_op & MSN_LIST_BL_OP){
+	if (list_op & MSN_LIST_BL_OP)
+	{
 		/* These are users who are not allowed to see our status. */
 		gaim_privacy_permit_remove(account, passport, TRUE);
 		gaim_privacy_deny_add(account, passport, TRUE);
 	}
 
-	if (list_op & MSN_LIST_RL_OP){
+	if (list_op & MSN_LIST_RL_OP)
+	{
 		/* These are users who have us on their buddy list. */
 		/*
 		 * TODO: What is store name set to when this happens?
@@ -367,7 +388,8 @@
 		 *       should use the friendly name, instead? --KingAnt
 		 */
 
-		if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))){
+		if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP)))
+		{
 //			got_new_entry(gc, passport, store);
 		}
 	}
@@ -403,13 +425,15 @@
 	GList *l;
 
 	/*destroy userlist*/
-	for (l = userlist->users; l != NULL; l = l->next){
+	for (l = userlist->users; l != NULL; l = l->next)
+	{
 		msn_user_destroy(l->data);
 	}
 	g_list_free(userlist->users);
 
 	/*destroy group list*/
-	for (l = userlist->groups; l != NULL; l = l->next){
+	for (l = userlist->groups; l != NULL; l = l->next)
+	{
 		msn_group_destroy(l->data);
 	}
 	g_list_free(userlist->groups);
@@ -428,7 +452,8 @@
 	MsnUser *user;
 
 	user = msn_userlist_find_user(userlist, passport);
-	if (user == NULL){
+	if (user == NULL)
+	{
 		user = msn_user_new(userlist, passport, userName);
 		msn_userlist_add_user(userlist, user);
 	}
@@ -455,12 +480,14 @@
 
 	g_return_val_if_fail(passport != NULL, NULL);
 
-	for (l = userlist->users; l != NULL; l = l->next){
+	for (l = userlist->users; l != NULL; l = l->next)
+	{
 		MsnUser *user = (MsnUser *)l->data;
 //		gaim_debug_info("MsnUserList","user passport:%s,passport:%s\n",user->passport,passport);
 		g_return_val_if_fail(user->passport != NULL, NULL);
 
-		if (!g_strcasecmp(passport, user->passport)){
+		if (!g_strcasecmp(passport, user->passport))
+		{
 //			gaim_debug_info("MsnUserList","return:%p\n",user);
 			return user;
 		}
@@ -489,10 +516,11 @@
 	g_return_val_if_fail(userlist != NULL, NULL);
 	g_return_val_if_fail(id       != NULL, NULL);
 
-	for (l = userlist->groups; l != NULL; l = l->next){
+	for (l = userlist->groups; l != NULL; l = l->next)
+	{
 		MsnGroup *group = l->data;
 
-		if (!g_strcasecmp(group->id,id))
+		if (!g_strcasecmp(group->id, id))
 			return group;
 	}
 
@@ -507,7 +535,8 @@
 	g_return_val_if_fail(userlist != NULL, NULL);
 	g_return_val_if_fail(name     != NULL, NULL);
 
-	for (l = userlist->groups; l != NULL; l = l->next){
+	for (l = userlist->groups; l != NULL; l = l->next)
+	{
 		MsnGroup *group = l->data;
 
 		if ((group->name != NULL) && !g_strcasecmp(name, group->name))
@@ -524,9 +553,12 @@
 
 	group = msn_userlist_find_group_with_name(userlist, group_name);
 
-	if (group != NULL){
+	if (group != NULL)
+	{
 		return msn_group_get_id(group);
-	}else{
+	}
+	else
+	{
 		return NULL;
 	}
 }
@@ -538,9 +570,12 @@
 
 	group = msn_userlist_find_group_with_id(userlist, group_id);
 
-	if (group != NULL){
+	if (group != NULL)
+	{
 		return msn_group_get_name(group);
-	}else{
+	}
+	else
+	{
 		return NULL;
 	}
 }
@@ -599,7 +634,8 @@
 	}
 
 	/* First we're going to check if not there. */
-	if (!(user_is_there(user, list_id, group_id))){
+	if (!(user_is_there(user, list_id, group_id)))
+	{
 		list = lists[list_id];
 		gaim_debug_error("msn", "User '%s' is not there: %s\n",
 						 who, list);
@@ -626,11 +662,13 @@
 	gaim_debug_info("MaYuan", "userlist add buddy,name:{%s},group:{%s}\n",who ,group_name);
 	group_id = NULL;
 
-	if (!gaim_email_is_valid(who)){
+	if (!gaim_email_is_valid(who))
+	{
 		/* only notify the user about problems adding to the friends list
 		 * maybe we should do something else for other lists, but it probably
 		 * won't cause too many problems if we just ignore it */
-		if (list_id == MSN_LIST_FL)	{
+		if (list_id == MSN_LIST_FL)
+		{
 			char *str = g_strdup_printf(_("Unable to add \"%s\"."), who);
 			gaim_notify_error(NULL, NULL, str,
 							  _("The screen name specified is invalid."));
@@ -640,10 +678,12 @@
 		return;
 	}
 
-	if (group_name != NULL){
+	if (group_name != NULL)
+	{
 		group_id = msn_userlist_find_group_id(userlist, group_name);
 
-		if (group_id == NULL){
+		if (group_id == NULL)
+		{
 			/* Whoa, we must add that group first. */
 			msn_request_add_group(userlist, who, NULL, group_name);
 			return;
@@ -653,7 +693,8 @@
 	user = msn_userlist_find_user(userlist, who);
 
 	/* First we're going to check if it's already there. */
-	if (user_is_there(user, list_id, group_id)){
+	if (user_is_there(user, list_id, group_id))
+	{
 		list = lists[list_id];
 		gaim_debug_error("msn", "User '%s' is already there: %s\n", who, list);
 		return;
@@ -666,10 +707,8 @@
 
 	gaim_debug_info("MaYuan", "add user:{%s} to group id {%s}\n",store_name ,group_id);
 	msn_add_contact(userlist->session->contact,who,group_id);
-#if 1
 	msn_notification_add_buddy(userlist->session->notification, list, who,
 							   store_name, group_id);
-#endif
 }
 
 void
@@ -680,7 +719,8 @@
 
 	new_group_id = msn_userlist_find_group_id(userlist, new_group_name);
 
-	if (new_group_id == NULL){
+	if (new_group_id == NULL)
+	{
 		msn_request_add_group(userlist, who, old_group_name, new_group_name);
 		return;
 	}
@@ -700,18 +740,22 @@
 
 	g_return_if_fail(gc != NULL);
 
-	for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next){
-		if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
+	for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
+	{
+		if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
 			continue;
-		for(cnode = gnode->child; cnode; cnode = cnode->next) {
-			if(!GAIM_BLIST_NODE_IS_CONTACT(cnode))
+		for (cnode = gnode->child; cnode; cnode = cnode->next)
+		{
+			if (!GAIM_BLIST_NODE_IS_CONTACT(cnode))
 				continue;
-			for(bnode = cnode->child; bnode; bnode = bnode->next) {
+			for (bnode = cnode->child; bnode; bnode = bnode->next)
+			{
 				GaimBuddy *b;
-				if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
+				if (!GAIM_BLIST_NODE_IS_BUDDY(bnode))
 					continue;
 				b = (GaimBuddy *)bnode;
-				if(b->account == gc->account){
+				if (b->account == gc->account)
+				{
 					user = msn_userlist_find_add_user(session->userlist,
 						b->name,NULL);
 					msn_user_set_op(user,MSN_LIST_FL_OP);
@@ -719,16 +763,17 @@
 			}
 		}
 	}
-	for (l = session->account->permit; l != NULL; l = l->next) {
+	for (l = session->account->permit; l != NULL; l = l->next)
+	{
 		user = msn_userlist_find_add_user(session->userlist,
 						(char *)l->data,NULL);
 		msn_user_set_op(user,MSN_LIST_AL_OP);
 	}
-	for (l = session->account->deny; l != NULL; l = l->next) {
+	for (l = session->account->deny; l != NULL; l = l->next)
+	{
 		user = msn_userlist_find_add_user(session->userlist,
 						(char *)l->data,NULL);
 		msn_user_set_op(user,MSN_LIST_BL_OP);
 	}
-	
 }