gboolean msn_userlist_add_buddy_to_group(MsnUserList *userlist, const char *who, const char *group_name) { MsnUser *user; gchar * group_id; g_return_val_if_fail(userlist != NULL, FALSE); g_return_val_if_fail(group_name != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); purple_debug_info("msn", "Adding buddy with passport %s to group %s\n", who, group_name); if ( (group_id = (gchar *)msn_userlist_find_group_id(userlist, group_name)) == NULL) { purple_debug_error("msn", "Group %s has no guid!\n", group_name); return FALSE; } if ( (user = msn_userlist_find_user(userlist, who)) == NULL) { purple_debug_error("msn", "User %s not found!\n", who); return FALSE; } msn_user_add_group_id(user, group_id); return TRUE; }
void msn_got_lst_user(MsnSession *session, MsnUser *user, int list_op, GSList *group_ids) { PurpleConnection *gc; PurpleAccount *account; const char *passport; const char *store; account = session->account; gc = purple_account_get_connection(account); passport = msn_user_get_passport(user); store = msn_user_get_friendly_name(user); if (list_op & MSN_LIST_AL_OP) { /* These are users who are allowed to see our status. */ purple_privacy_deny_remove(account, passport, TRUE); purple_privacy_permit_add(account, passport, TRUE); } if (list_op & MSN_LIST_BL_OP) { /* These are users who are not allowed to see our status. */ purple_privacy_permit_remove(account, passport, TRUE); purple_privacy_deny_add(account, passport, TRUE); } if (list_op & MSN_LIST_FL_OP) { GSList *c; for (c = group_ids; c != NULL; c = g_slist_next(c)) { int group_id; group_id = GPOINTER_TO_INT(c->data); msn_user_add_group_id(user, group_id); } /* FIXME: It might be a real alias */ /* Umm, what? This might fix bug #1385130 */ serv_got_alias(gc, passport, store); } 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? * For one of my accounts "*****@*****.**" * the store name was "something." Maybe we * should use the friendly name, instead? --KingAnt */ if (!(list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) { got_new_entry(gc, passport, store); } } user->list_op = list_op; }
void msn_got_add_user(MsnSession *session, MsnUser *user, MsnListId list_id, int group_id) { PurpleAccount *account; const char *passport; const char *friendly; account = session->account; passport = msn_user_get_passport(user); friendly = msn_user_get_friendly_name(user); if (list_id == MSN_LIST_FL) { PurpleConnection *gc; gc = purple_account_get_connection(account); serv_got_alias(gc, passport, friendly); if (group_id >= 0) { msn_user_add_group_id(user, group_id); } else { /* session->sync->fl_users_count++; */ } } else if (list_id == MSN_LIST_AL) { purple_privacy_permit_add(account, passport, TRUE); } else if (list_id == MSN_LIST_BL) { purple_privacy_deny_add(account, passport, TRUE); } else if (list_id == MSN_LIST_RL) { PurpleConnection *gc; PurpleConversation *convo; gc = purple_account_get_connection(account); purple_debug_info("msn", "%s has added you to his or her buddy list.\n", passport); convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, passport, account); if (convo) { PurpleBuddy *buddy; char *msg; buddy = purple_find_buddy(account, passport); msg = g_strdup_printf( _("%s has added you to his or her buddy list."), buddy ? purple_buddy_get_contact_alias(buddy) : passport); purple_conv_im_write(PURPLE_CONV_IM(convo), passport, msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); g_free(msg); } if (!(user->list_op & (MSN_LIST_AL_OP | MSN_LIST_BL_OP))) { /* * TODO: The friendly name was NULL for me when I * looked at this. Maybe we should use the store * name instead? --KingAnt */ got_new_entry(gc, passport, friendly); } } user->list_op |= (1 << list_id); /* purple_user_add_list_id (user, list_id); */ }