changeset 31255:2327aa51a780

Move an user utility function to User.
author masca@cpw.pidgin.im
date Sat, 19 Jun 2010 23:23:23 +0000
parents e26b590bbf76
children ead7b8c19725
files libpurple/protocols/msn/switchboard.c libpurple/protocols/msn/user.c libpurple/protocols/msn/user.h
diffstat 3 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/switchboard.c	Sat Jun 19 23:21:44 2010 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Sat Jun 19 23:23:23 2010 +0000
@@ -228,16 +228,6 @@
 	msn_message_destroy(msg);
 }
 
-static int
-user_passport_cmp(MsnUser *user, const char *passport)
-{
-	const char *pass;
-
-	pass = msn_user_get_passport(user);
-
-	return strcmp(pass, passport);
-}
-
 static void
 msn_switchboard_add_user(MsnSwitchBoard *swboard, const char *user)
 {
@@ -264,7 +254,7 @@
 	msnuser = msn_userlist_find_user(userlist, passport);
 
 	/* Don't add multiple endpoints to the conversation. */
-	if (g_list_find_custom(swboard->users, passport, (GCompareFunc)user_passport_cmp)) {
+	if (g_list_find_custom(swboard->users, passport, (GCompareFunc)msn_user_passport_cmp)) {
 		g_free(passport);
 		return;
 	}
--- a/libpurple/protocols/msn/user.c	Sat Jun 19 23:21:44 2010 +0000
+++ b/libpurple/protocols/msn/user.c	Sat Jun 19 23:23:23 2010 +0000
@@ -666,6 +666,16 @@
  * Utility functions
  **************************************************************************/
 
+int
+msn_user_passport_cmp(MsnUser *user, const char *passport)
+{
+	const char *pass;
+
+	pass = msn_user_get_passport(user);
+
+	return strcmp(pass, passport);
+}
+
 gboolean
 msn_user_is_in_group(MsnUser *user, const char * group_id)
 {
--- a/libpurple/protocols/msn/user.h	Sat Jun 19 23:21:44 2010 +0000
+++ b/libpurple/protocols/msn/user.h	Sat Jun 19 23:23:23 2010 +0000
@@ -490,6 +490,18 @@
 void msn_user_unset_op(MsnUser *user, MsnListOp list_op);
 
 /**
+ * Compare the given passport with the one of the user
+ *
+ * @param user 	User to compare.
+ * @oaran passport 	Passport to compare.
+ *
+ * @return Zero if the passport match with the one of the user, otherwise
+ * a positive integer if the user passport is greather than the one given
+ * and a negative integer if it is less.
+ */
+int msn_user_passport_cmp(MsnUser *user, const char *passport);
+
+/**
  * Checks whether a user is capable of some task.
  *
  * @param user       The user.