# HG changeset patch # User masca@cpw.pidgin.im # Date 1273891598 0 # Node ID 02dc01aa8c072e6e7cbab7e6f6c15bf166ce736a # Parent f8ec889c5bce0cc4c6fcff877fe8fc632804464c This are MsnUser functions, move them there. diff -r f8ec889c5bce -r 02dc01aa8c07 libpurple/protocols/msn/user.c --- a/libpurple/protocols/msn/user.c Mon May 10 23:21:44 2010 +0000 +++ b/libpurple/protocols/msn/user.c Sat May 15 02:46:38 2010 +0000 @@ -632,3 +632,29 @@ return (user->clientid & capability) && (user->extcaps & extcap); } + +/************************************************************************** + * Utility functions + **************************************************************************/ + +gboolean +msn_user_is_in_group(MsnUser *user, const char * group_id) +{ + if (user == NULL) + return FALSE; + + if (group_id == NULL) + return FALSE; + + return (g_list_find_custom(user->group_ids, group_id, (GCompareFunc)strcmp)) != NULL; +} + +gboolean +msn_user_is_in_list(MsnUser *user, MsnListId list_id) +{ + if (user == NULL) + return FALSE; + + return (user->list_op & (1 << list_id)); +} + diff -r f8ec889c5bce -r 02dc01aa8c07 libpurple/protocols/msn/user.h --- a/libpurple/protocols/msn/user.h Mon May 10 23:21:44 2010 +0000 +++ b/libpurple/protocols/msn/user.h Sat May 15 02:46:38 2010 +0000 @@ -406,6 +406,30 @@ */ guint msn_user_get_extcaps(const MsnUser *user); +/************************************************************************** + * Utility functions + **************************************************************************/ + + +/** + * Check if the user is part of the group. + * + * @param user The user we are asking group membership. + * @param group_id The group where the user may be in. + * + * @return TRUE if user is part of the group. Otherwise, FALSE. + */ +gboolean msn_user_is_in_group(MsnUser *user, const char * group_id); + +/** + * Check if user is on list. + * + * @param user The user we are asking list membership. + * @param list_id The list where the user may be in. + * + * @return TRUE if the user is on the list, else FALSE. + */ +gboolean msn_user_is_in_list(MsnUser *user, MsnListId list_id); /** * Returns the network id for a user. * diff -r f8ec889c5bce -r 02dc01aa8c07 libpurple/protocols/msn/userlist.c --- a/libpurple/protocols/msn/userlist.c Mon May 10 23:21:44 2010 +0000 +++ b/libpurple/protocols/msn/userlist.c Sat May 15 02:46:38 2010 +0000 @@ -107,31 +107,6 @@ } /************************************************************************** - * Utility functions - **************************************************************************/ - -gboolean -msn_userlist_user_is_in_group(MsnUser *user, const char * group_id) -{ - if (user == NULL) - return FALSE; - - if (group_id == NULL) - 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) -{ - if (user == NULL) - return FALSE; - - return (user->list_op & (1 << list_id)); -} - -/************************************************************************** * Server functions **************************************************************************/ @@ -503,7 +478,7 @@ g_return_if_fail(user != NULL); - if ( !msn_userlist_user_is_in_list(user, list_id)) { + if ( !msn_user_is_in_list(user, list_id)) { list = lists[list_id]; purple_debug_info("msn", "User %s is not in list %s, not removing.\n", who, list); return; @@ -569,13 +544,13 @@ user = msn_userlist_find_add_user(userlist, who, who); - if ( msn_userlist_user_is_in_list(user, MSN_LIST_FL) ) { + if ( msn_user_is_in_list(user, MSN_LIST_FL) ) { purple_debug_info("msn", "User %s already exists\n", who); msn_userlist_rem_buddy_from_list(userlist, who, MSN_LIST_BL); - if (msn_userlist_user_is_in_group(user, group_id)) { + if (msn_user_is_in_group(user, group_id)) { purple_debug_info("msn", "User %s is already in group %s, returning\n", who, new_group_name); msn_callback_state_free(state); return; @@ -604,7 +579,7 @@ user = msn_userlist_find_add_user(userlist, who, who); /* First we're going to check if it's already there. */ - if (msn_userlist_user_is_in_list(user, list_id)) + if (msn_user_is_in_list(user, list_id)) { list = lists[list_id]; purple_debug_info("msn", "User '%s' is already in list: %s\n", who, list); diff -r f8ec889c5bce -r 02dc01aa8c07 libpurple/protocols/msn/userlist.h --- a/libpurple/protocols/msn/userlist.h Mon May 10 23:21:44 2010 +0000 +++ b/libpurple/protocols/msn/userlist.h Sat May 15 02:46:38 2010 +0000 @@ -52,9 +52,6 @@ }; -gboolean msn_userlist_user_is_in_group(MsnUser *user, const char * group_id); -gboolean msn_userlist_user_is_in_list(MsnUser *user, MsnListId list_id); - void msn_got_lst_user(MsnSession *session, MsnUser *user, MsnListOp list_op, GSList *group_ids);