void purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local, gboolean restore) { GSList *list; switch (account->perm_deny) { case PURPLE_PRIVACY_ALLOW_ALL: if (!restore) { /* Empty the deny-list. */ for (list = account->deny; list != NULL; ) { char *person = list->data; list = list->next; purple_privacy_deny_remove(account, person, local); } } purple_privacy_deny_add(account, who, local); account->perm_deny = PURPLE_PRIVACY_DENY_USERS; break; case PURPLE_PRIVACY_ALLOW_USERS: purple_privacy_permit_remove(account, who, local); break; case PURPLE_PRIVACY_DENY_USERS: purple_privacy_deny_add(account, who, local); break; case PURPLE_PRIVACY_DENY_ALL: break; case PURPLE_PRIVACY_ALLOW_BUDDYLIST: if (purple_find_buddy(account, who)) { add_buddies_in_permit(account, local); purple_privacy_permit_remove(account, who, local); account->perm_deny = PURPLE_PRIVACY_ALLOW_USERS; } break; default: g_return_if_reached(); } }
/************************************************************************** * Callbacks **************************************************************************/ static void msn_accept_add_cb(gpointer data) { MsnPermitAdd *pa = data; purple_debug_misc("msn", "Accepted the new buddy: %s\n", pa->who); if (PURPLE_CONNECTION_IS_VALID(pa->gc)) { MsnSession *session = pa->gc->proto_data; MsnUserList *userlist = session->userlist; PurpleAccount *account = purple_connection_get_account(pa->gc); msn_userlist_add_buddy_to_list(userlist, pa->who, MSN_LIST_AL); purple_privacy_deny_remove(account, pa->who, TRUE); purple_privacy_permit_add(account, pa->who, TRUE); msn_del_contact_from_list(session, NULL, pa->who, MSN_LIST_PL); } g_free(pa->who); g_free(pa->friendly); g_free(pa); }
static void purple_rem_deny( struct im_connection *ic, char *who ) { PurpleAccount *pa = ic->proto_data; purple_privacy_deny_remove( pa, who, FALSE ); }
static void purple_rem_deny(struct im_connection *ic, char *who) { struct purple_data *pd = ic->proto_data; purple_privacy_deny_remove(pd->account, who, FALSE); }
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_rem_user(MsnSession *session, MsnUser *user, MsnListId list_id, int group_id) { PurpleAccount *account; const char *passport; account = session->account; passport = msn_user_get_passport(user); if (list_id == MSN_LIST_FL) { /* TODO: When is the user totally removed? */ if (group_id >= 0) { msn_user_remove_group_id(user, group_id); return; } else { /* session->sync->fl_users_count--; */ } } else if (list_id == MSN_LIST_AL) { purple_privacy_permit_remove(account, passport, TRUE); } else if (list_id == MSN_LIST_BL) { purple_privacy_deny_remove(account, passport, TRUE); } else if (list_id == MSN_LIST_RL) { PurpleConversation *convo; purple_debug_info("msn", "%s has removed you from 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 removed you from 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); } } user->list_op &= ~(1 << list_id); /* purple_user_remove_list_id (user, list_id); */ if (user->list_op == 0) { purple_debug_info("msn", "Buddy '%s' shall be deleted?.\n", passport); } }