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(); } }
void gaim_privacy_allow(GaimAccount *account, const char *who, gboolean local, gboolean restore) { GSList *list; switch (account->perm_deny) { case GAIM_PRIVACY_ALLOW_ALL: return; case GAIM_PRIVACY_ALLOW_USERS: gaim_privacy_permit_add(account, who, local); break; case GAIM_PRIVACY_DENY_USERS: gaim_privacy_deny_remove(account, who, local); break; case GAIM_PRIVACY_DENY_ALL: if (!restore) { /* Empty the allow-list. */ for (list = account->permit; list != NULL;) { char *who = list->data; list = list->next; gaim_privacy_permit_remove(account, who, local); } } gaim_privacy_permit_add(account, who, local); account->perm_deny = GAIM_PRIVACY_ALLOW_USERS; break; case GAIM_PRIVACY_ALLOW_BUDDYLIST: if (!gaim_find_buddy(account, who)) { add_buddies_in_permit(account, local); gaim_privacy_permit_add(account, who, local); account->perm_deny = GAIM_PRIVACY_ALLOW_USERS; } break; default: g_return_if_reached(); } }