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(); } }
/* This makes sure that only all the buddies are in the permit list. */ static void add_buddies_in_permit(PurpleAccount *account, gboolean local) { GSList *list; /* Remove anyone in the permit list who is not in the buddylist */ for (list = account->permit; list != NULL; ) { char *person = list->data; list = list->next; if (!purple_find_buddy(account, person)) purple_privacy_permit_remove(account, person, local); } /* Now make sure everyone in the buddylist is in the permit list */ list = purple_find_buddies(account, NULL); while (list != NULL) { PurpleBuddy *buddy = list->data; if (!g_slist_find_custom(account->permit, buddy->name, (GCompareFunc)g_utf8_collate)) purple_privacy_permit_add(account, buddy->name, local); list = g_slist_delete_link(list, list); } }
static void purple_rem_permit( struct im_connection *ic, char *who ) { PurpleAccount *pa = ic->proto_data; purple_privacy_permit_remove( pa, who, FALSE ); }
static void purple_rem_permit(struct im_connection *ic, char *who) { struct purple_data *pd = ic->proto_data; purple_privacy_permit_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); } }