diff libgaim/protocols/msn/userlist.c @ 20397:6ac7e33fdabf

propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-1-rlaager-whitespace' (head 5083cfbc09503360bacf3ff0ebf528700770e6af) to branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4-rlaager-whitespace' (head 4d82c29e56bd33cd6f94302e343dfeb5d68ab3eb)
author Richard Laager <rlaager@wiktel.com>
date Sun, 15 Apr 2007 03:04:05 +0000
parents 9ba7dee775e1 9755b2f7bb0f
children
line wrap: on
line diff
--- a/libgaim/protocols/msn/userlist.c	Sun Apr 15 03:02:48 2007 +0000
+++ b/libgaim/protocols/msn/userlist.c	Sun Apr 15 03:04:05 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);
 					b->proto_data = user;
@@ -720,16 +764,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);
 	}
-	
 }