diff libpurple/protocols/msn/userlist.c @ 30954:48f70e888c04

propagate from branch 'im.pidgin.pidgin' (head 8cc16fcb41111aae817fe10168b40d82990895c5) to branch 'im.pidgin.cpw.malu.xmpp.google_relay' (head 72d65c944b0cad18592ac527559d320f9fd32e58)
author Marcus Lundblad <ml@update.uu.se>
date Sun, 14 Feb 2010 22:26:14 +0000
parents 7f97370e674b
children 02dc01aa8c07
line wrap: on
line diff
--- a/libpurple/protocols/msn/userlist.c	Fri Jan 08 23:33:51 2010 +0000
+++ b/libpurple/protocols/msn/userlist.c	Sun Feb 14 22:26:14 2010 +0000
@@ -119,26 +119,16 @@
 	if (group_id == NULL)
 		return FALSE;
 
-	if (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp))
-		return TRUE;
-
-	return FALSE;
+	return (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) != NULL;
 }
 
 gboolean
 msn_userlist_user_is_in_list(MsnUser *user, MsnListId list_id)
 {
-	int list_op;
-
 	if (user == NULL)
 		return FALSE;
 
-	list_op = 1 << list_id;
-
-	if (user->list_op & list_op)
-		return TRUE;
-	else
-		return FALSE;
+	return (user->list_op & (1 << list_id));
 }
 
 /**************************************************************************
@@ -147,7 +137,7 @@
 
 void
 msn_got_lst_user(MsnSession *session, MsnUser *user,
-				 int list_op, GSList *group_ids)
+				 MsnListOp list_op, GSList *group_ids)
 {
 	PurpleConnection *gc;
 	PurpleAccount *account;
@@ -344,14 +334,10 @@
 
 	for (l = userlist->users; l != NULL; l = l->next) {
 		MsnUser *user = (MsnUser *)l->data;
+		const char *user_number = msn_user_get_mobile_phone(user);
 
-		if (user->phone.mobile == NULL) {
-			continue;
-		}
-
-		if (!g_ascii_strcasecmp(number, user->phone.mobile)) {
+		if (user_number && !g_ascii_strcasecmp(number, user_number))
 			return user;
-		}
 	}
 
 	return NULL;