Mon, 17 Jun 2013 23:39:13 +0530
Refactored prpls according to the changed PurpleAccount API
--- a/libpurple/account.h Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/account.h Mon Jun 17 23:39:13 2013 +0530 @@ -862,7 +862,7 @@ * Returns the account's permit list. * * @param account The account. - * @return A GSList of the permitted users + * @constreturn A list of the permitted users */ GSList *purple_account_privacy_get_permitted(PurpleAccount *account); @@ -870,7 +870,7 @@ * Returns the account's deny list. * * @param account The account. - * @return A GSList of the denied users + * @constreturn A list of the denied users */ GSList *purple_account_privacy_get_denied(PurpleAccount *account);
--- a/libpurple/protocols/bonjour/jabber.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/bonjour/jabber.c Mon Jun 17 23:39:13 2013 +0530 @@ -1303,7 +1303,7 @@ acc = purple_buddy_get_account(pb); - for(l = acc->deny; l != NULL; l = l->next) { + for(l = purple_account_privacy_get_denied(acc); l != NULL; l = l->next) { const gchar *name = purple_buddy_get_name(pb); const gchar *username = bonjour_get_jid(acc);
--- a/libpurple/protocols/jabber/google/google_roster.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/jabber/google/google_roster.c Mon Jun 17 23:39:13 2013 +0530 @@ -28,7 +28,7 @@ void jabber_google_roster_outgoing(JabberStream *js, xmlnode *query, xmlnode *item) { PurpleAccount *account = purple_connection_get_account(js->gc); - GSList *list = account->deny; + GSList *list = purple_account_privacy_get_denied(account); const char *jid = xmlnode_get_attrib(item, "jid"); char *jid_norm = (char *)jabber_normalize(account, jid); @@ -64,8 +64,8 @@ jid_norm = g_strdup(jabber_normalize(account, jid)); - on_block_list = NULL != g_slist_find_custom(account->deny, jid_norm, - (GCompareFunc)strcmp); + on_block_list = NULL != g_slist_find_custom(purple_account_privacy_get_denied(account), + jid_norm, (GCompareFunc)strcmp); if (grt && (*grt == 'H' || *grt == 'h')) { /* Hidden; don't show this buddy. */ @@ -86,10 +86,10 @@ if (!on_block_list && (grt && (*grt == 'B' || *grt == 'b'))) { purple_debug_info("jabber", "Blocking %s\n", jid_norm); - purple_privacy_deny_add(account, jid_norm, TRUE); + purple_account_privacy_deny_add(account, jid_norm, TRUE); } else if (on_block_list && (!grt || (*grt != 'B' && *grt != 'b' ))){ purple_debug_info("jabber", "Unblocking %s\n", jid_norm); - purple_privacy_deny_remove(account, jid_norm, TRUE); + purple_account_privacy_deny_remove(account, jid_norm, TRUE); } g_free(jid_norm);
--- a/libpurple/protocols/jabber/jabber.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/jabber/jabber.c Mon Jun 17 23:39:13 2013 +0530 @@ -35,7 +35,6 @@ #include "message.h" #include "notify.h" #include "pluginpref.h" -#include "privacy.h" #include "proxy.h" #include "prpl.h" #include "request.h" @@ -1799,6 +1798,7 @@ xmlnode *item; PurpleAccount *account; gboolean is_block; + GSList *deny; if (!jabber_is_own_account(js, from)) { xmlnode *error, *x; @@ -1824,8 +1824,8 @@ /* Unblock everyone */ purple_debug_info("jabber", "Received unblock push. Unblocking everyone.\n"); - while (account->deny != NULL) { - purple_privacy_deny_remove(account, account->deny->data, TRUE); + while ((deny = purple_account_privacy_get_denied(account)) != NULL) { + purple_account_privacy_deny_remove(account, deny->data, TRUE); } } else if (item == NULL) { /* An empty <block/> is bogus */ @@ -1847,9 +1847,9 @@ continue; if (is_block) - purple_privacy_deny_add(account, jid, TRUE); + purple_account_privacy_deny_add(account, jid, TRUE); else - purple_privacy_deny_remove(account, jid, TRUE); + purple_account_privacy_deny_remove(account, jid, TRUE); } } @@ -1864,6 +1864,7 @@ { xmlnode *blocklist, *item; PurpleAccount *account; + GSList *deny; blocklist = xmlnode_get_child_with_namespace(packet, "blocklist", NS_SIMPLE_BLOCKING); @@ -1873,19 +1874,19 @@ return; /* This is the only privacy method supported by XEP-0191 */ - purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); + purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS); /* * TODO: When account->deny is something more than a hash table, this can * be re-written to find the set intersection and difference. */ - while (account->deny) - purple_privacy_deny_remove(account, account->deny->data, TRUE); + while ((deny = purple_account_privacy_get_denied(account))) + purple_account_privacy_deny_remove(account, deny->data, TRUE); item = xmlnode_get_child(blocklist, "item"); while (item != NULL) { const char *jid = xmlnode_get_attrib(item, "jid"); - purple_privacy_deny_add(account, jid, TRUE); + purple_account_privacy_deny_add(account, jid, TRUE); item = xmlnode_get_next_twin(item); } }
--- a/libpurple/protocols/msn/contact.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/msn/contact.c Mon Jun 17 23:39:13 2013 +0530 @@ -1664,10 +1664,10 @@ msn_add_contact_to_list(session, new_state, state->who, MSN_LIST_RL); return; } else if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_remove(session->account, state->who, TRUE); + purple_account_privacy_permit_remove(session->account, state->who, TRUE); msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_BL); } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_remove(session->account, state->who, TRUE); + purple_account_privacy_deny_remove(session->account, state->who, TRUE); msn_add_contact_to_list(session, NULL, state->who, MSN_LIST_AL); } @@ -1764,9 +1764,9 @@ if (state->action & MSN_DENIED_BUDDY) { msn_add_contact_to_list(state->session, NULL, state->who, MSN_LIST_BL); } else if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_add(state->session->account, state->who, TRUE); + purple_account_privacy_permit_add(state->session->account, state->who, TRUE); } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_add(state->session->account, state->who, TRUE); + purple_account_privacy_deny_add(state->session->account, state->who, TRUE); } } }
--- a/libpurple/protocols/msn/msn.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/msn/msn.c Mon Jun 17 23:39:13 2013 +0530 @@ -814,8 +814,8 @@ session = purple_connection_get_protocol_data(gc); cmdproc = session->notification->cmdproc; - if (purple_account_get_privacy_type(account) == PURPLE_PRIVACY_ALLOW_ALL || - purple_account_get_privacy_type(account) == PURPLE_PRIVACY_DENY_USERS) + if (purple_account_get_privacy_type(account) == PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL || + purple_account_get_privacy_type(account) == PURPLE_ACCOUNT_PRIVACY_DENY_USERS) trans = msn_transaction_new(cmdproc, "BLP", "%s", "AL"); else trans = msn_transaction_new(cmdproc, "BLP", "%s", "BL");
--- a/libpurple/protocols/msn/userlist.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/msn/userlist.c Mon Jun 17 23:39:13 2013 +0530 @@ -59,8 +59,8 @@ 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); + purple_account_privacy_deny_remove(account, pa->who, TRUE); + purple_account_privacy_permit_add(account, pa->who, TRUE); msn_del_contact_from_list(session, NULL, pa->who, MSN_LIST_PL); } @@ -152,15 +152,15 @@ 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); + purple_account_privacy_deny_remove(account, passport, TRUE); + purple_account_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); + purple_account_privacy_permit_remove(account, passport, TRUE); + purple_account_privacy_deny_add(account, passport, TRUE); } if (list_op & MSN_LIST_RL_OP) @@ -742,13 +742,13 @@ purple_buddy_set_protocol_data(buddy, user); msn_user_set_op(user, MSN_LIST_FL_OP); } - for (l = session->account->permit; l != NULL; l = l->next) + for (l = purple_account_privacy_get_permitted(session->account); l != NULL; l = l->next) { user = msn_userlist_find_add_user(session->userlist, (char *)l->data,NULL); msn_user_set_op(user, MSN_LIST_AL_OP); } - for (l = session->account->deny; l != NULL; l = l->next) + for (l = purple_account_privacy_get_denied(session->account); l != NULL; l = l->next) { user = msn_userlist_find_add_user(session->userlist, (char *)l->data,NULL);
--- a/libpurple/protocols/myspace/myspace.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/myspace/myspace.c Mon Jun 17 23:39:13 2013 +0530 @@ -36,8 +36,6 @@ #include "myspace.h" -#include "privacy.h" - static void msim_set_status(PurpleAccount *account, PurpleStatus *status); static void msim_set_idle(PurpleConnection *gc, int time); @@ -1019,7 +1017,7 @@ visibility = msim_msg_get_integer(contact_info, "Visibility"); if (visibility == 2) { /* This buddy is blocked (and therefore not on our buddy list */ - purple_privacy_deny_add(session->account, username, TRUE); + purple_account_privacy_deny_add(session->account, username, TRUE); msim_msg_free(contact_info); g_free(username); g_free(display_name); @@ -2179,6 +2177,7 @@ { PurpleConnection *gc; const gchar *host; + GSList *deny; int port; g_return_if_fail(acct != NULL); @@ -2195,8 +2194,8 @@ * list of all blocked buddies from the server, and we shouldn't * have stuff in the local list that isn't on the server list. */ - while (acct->deny != NULL) - purple_privacy_deny_remove(acct, acct->deny->data, TRUE); + while ((deny = purple_account_privacy_get_denied(acct)) != NULL) + purple_account_privacy_deny_remove(acct, deny->data, TRUE); /* 1. connect to server */ purple_connection_update_progress(gc, _("Connecting"),
--- a/libpurple/protocols/novell/novell.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/novell/novell.c Mon Jun 17 23:39:13 2013 +0530 @@ -29,7 +29,6 @@ #include "sslconn.h" #include "request.h" #include "network.h" -#include "privacy.h" #include "status.h" #include "version.h" @@ -726,6 +725,7 @@ gpointer resp_data, gpointer user_data) { PurpleConnection *gc; + PurpleAccount *account; NMUserRecord *user_record = resp_data; char *err; gboolean allowed = GPOINTER_TO_INT(user_data); @@ -736,21 +736,22 @@ gc = purple_account_get_connection(user->client_data); display_id = nm_user_record_get_display_id(user_record); + account = purple_connection_get_account(gc); if (ret_code == NM_OK) { if (allowed) { - if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, + if (!g_slist_find_custom(purple_account_privacy_get_denied(account), display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); + purple_account_privacy_permit_add(account, display_id, TRUE); } } else { - if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, + if (!g_slist_find_custom(purple_account_privacy_get_denied(account), display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); + purple_account_privacy_deny_add(account, display_id, TRUE); } } @@ -770,6 +771,7 @@ gpointer resp_data, gpointer user_data) { PurpleConnection *gc; + PurpleAccount *account; NMUserRecord *user_record; char *who = user_data; char *err; @@ -780,6 +782,7 @@ return; gc = purple_account_get_connection(user->client_data); + account = purple_connection_get_account(gc); if (ret_code == NM_OK) { @@ -789,10 +792,10 @@ if (display_id) { - if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, + if (!g_slist_find_custom(purple_account_privacy_get_denied(account), display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE); + purple_account_privacy_deny_add(account, display_id, TRUE); } } else { @@ -821,6 +824,7 @@ gpointer resp_data, gpointer user_data) { PurpleConnection *gc; + PurpleAccount *account; NMUserRecord *user_record; char *who = user_data; char *err; @@ -831,6 +835,7 @@ return; gc = purple_account_get_connection(user->client_data); + account = purple_connection_get_account(gc); if (ret_code == NM_OK) { @@ -840,11 +845,11 @@ if (display_id) { - if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, + if (!g_slist_find_custom(purple_account_privacy_get_permitted(account), display_id, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE); + purple_account_privacy_permit_add(account, display_id, TRUE); } } else { @@ -1386,6 +1391,7 @@ { GSList *node = NULL, *rem_list = NULL; PurpleConnection *gc; + PurpleAccount *account; const char *name, *dn; NMUserRecord *user_record; @@ -1396,18 +1402,20 @@ if (gc == NULL) return; + account = purple_connection_get_account(gc); + /* Set the Purple privacy setting */ if (user->default_deny) { if (user->allow_list == NULL) { - purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_ALL); + purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_ALL); } else { - purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_USERS); + purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS); } } else { if (user->deny_list == NULL) { - purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_ALL); + purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL); } else { - purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_USERS); + purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS); } } @@ -1419,9 +1427,9 @@ else name =(char *)node->data; - if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, + if (!g_slist_find_custom(purple_account_privacy_get_permitted(account), name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); + purple_account_privacy_permit_add(account, name , TRUE); } } @@ -1432,15 +1440,15 @@ else name =(char *)node->data; - if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, + if (!g_slist_find_custom(purple_account_privacy_get_denied(account), name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(purple_connection_get_account(gc), name, TRUE); + purple_account_privacy_deny_add(account, name, TRUE); } } /* Remove stuff */ - for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { + for (node = purple_account_privacy_get_permitted(account); node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->allow_list, @@ -1451,13 +1459,13 @@ if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); + purple_account_privacy_permit_remove(account, (char *)node->data, TRUE); } g_slist_free(rem_list); rem_list = NULL; } - for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { + for (node = purple_account_privacy_get_denied(account); node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn != NULL && !g_slist_find_custom(user->deny_list, @@ -1468,7 +1476,7 @@ if (rem_list) { for (node = rem_list; node; node = node->next) { - purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); + purple_account_privacy_deny_remove(account, (char *)node->data, TRUE); } g_slist_free(rem_list); } @@ -3086,7 +3094,7 @@ /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE); + purple_account_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3130,7 +3138,7 @@ /* Remove first -- we will add it back in when we get * the okay from the server */ - purple_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE); + purple_account_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE); if (nm_user_is_privacy_locked(user)) { _show_privacy_locked_error(gc, user); @@ -3228,10 +3236,13 @@ int i, j, num_contacts, num_folders; NMContact *contact; NMFolder *folder = NULL; + PurpleAccount *account; if (gc == NULL) return; + account = purple_connection_get_account(gc); + user = purple_connection_get_protocol_data(gc); if (user == NULL) return; @@ -3248,9 +3259,9 @@ return; } - switch (purple_account_get_privacy_type(purple_connection_get_account(gc))) { - - case PURPLE_PRIVACY_ALLOW_ALL: + switch (purple_account_get_privacy_type(account)) { + + case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL: rc = nm_send_set_privacy_default(user, FALSE, _set_privacy_default_resp_cb, NULL); _check_for_disconnect(user, rc); @@ -3270,7 +3281,7 @@ } break; - case PURPLE_PRIVACY_DENY_ALL: + case PURPLE_ACCOUNT_PRIVACY_DENY_ALL: rc = nm_send_set_privacy_default(user, TRUE, _set_privacy_default_resp_cb, NULL); _check_for_disconnect(user, rc); @@ -3290,7 +3301,7 @@ } break; - case PURPLE_PRIVACY_ALLOW_USERS: + case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS: rc = nm_send_set_privacy_default(user, TRUE, _set_privacy_default_resp_cb, NULL); @@ -3304,14 +3315,14 @@ if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(purple_connection_get_account(gc)->permit, + if (!g_slist_find_custom(purple_account_privacy_get_permitted(account), name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE); + purple_account_privacy_permit_add(account, name , TRUE); } } } - for (node = purple_connection_get_account(gc)->permit; node; node = node->next) { + for (node = purple_account_privacy_get_permitted(account); node; node = node->next) { dn = nm_lookup_dn(user, (char *)node->data); if (dn) { @@ -3322,13 +3333,13 @@ g_strdup(dn)); } } else { - purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); + purple_account_privacy_permit_remove(account, (char *)node->data, TRUE); } } } break; - case PURPLE_PRIVACY_DENY_USERS: + case PURPLE_ACCOUNT_PRIVACY_DENY_USERS: /* set to default allow */ rc = nm_send_set_privacy_default(user, FALSE, @@ -3343,14 +3354,14 @@ if (user_record) { name = nm_user_record_get_display_id(user_record); - if (!g_slist_find_custom(purple_connection_get_account(gc)->deny, + if (!g_slist_find_custom(purple_account_privacy_get_denied(account), name, (GCompareFunc)purple_utf8_strcasecmp)) { - purple_privacy_deny_add(purple_connection_get_account(gc), name , TRUE); + purple_account_privacy_deny_add(account, name , TRUE); } } } - for (node = purple_connection_get_account(gc)->deny; node; node = node->next) { + for (node = purple_account_privacy_get_denied(account); node; node = node->next) { name = NULL; dn = nm_lookup_dn(user, (char *)node->data); @@ -3365,14 +3376,14 @@ g_strdup(name)); } } else { - purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE); + purple_account_privacy_deny_remove(account, (char *)node->data, TRUE); } } } break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: + case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST: /* remove users from allow list that are not in buddy list */ copy = g_slist_copy(user->allow_list);
--- a/libpurple/protocols/oscar/oscar.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/oscar/oscar.c Mon Jun 17 23:39:13 2013 +0530 @@ -41,7 +41,6 @@ #include "imgstore.h" #include "network.h" #include "notify.h" -#include "privacy.h" #include "prpl.h" #include "proxy.h" #include "request.h" @@ -3118,10 +3117,12 @@ } else { /* Don't send if this turkey is in our deny list */ + PurpleAccount *account = purple_connection_get_account(gc); GSList *list; - for (list=purple_connection_get_account(gc)->deny; (list && oscar_util_name_compare(name, list->data)); list=list->next); + + for (list=purple_account_privacy_get_denied(account); (list && oscar_util_name_compare(name, list->data)); list=list->next); if (!list) { - struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(purple_connection_get_account(gc), name)); + struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, purple_normalize(account, name)); if (bi && bi->typingnot) { if (state == PURPLE_TYPING) aim_im_sendmtn(od, 0x0001, name, 0x0002); @@ -3599,12 +3600,12 @@ /* * For ICQ the permit/deny setting controls who can see you - * online. Mimicking the official client's behavior, we use PURPLE_PRIVACY_ALLOW_USERS - * when our status is "invisible" and PURPLE_PRIVACY_DENY_USERS otherwise. + * online. Mimicking the official client's behavior, we use PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS + * when our status is "invisible" and PURPLE_ACCOUNT_PRIVACY_DENY_USERS otherwise. * In the former case, we are visible only to buddies on our "permanently visible" list. * In the latter, we are invisible only to buddies on our "permanently invisible" list. */ - aim_ssi_setpermdeny(od, invisible ? PURPLE_PRIVACY_ALLOW_USERS : PURPLE_PRIVACY_DENY_USERS); + aim_ssi_setpermdeny(od, invisible ? PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS : PURPLE_ACCOUNT_PRIVACY_DENY_USERS); } void @@ -3909,27 +3910,27 @@ /* Permit list (ICQ doesn't have one) */ if (!od->icq) { - next = account->permit; + next = purple_account_privacy_get_permitted(account); while (next != NULL) { cur = next; next = next->next; if (!aim_ssi_itemlist_finditem(&od->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { purple_debug_info("oscar", "ssi: removing permit %s from local list\n", (const char *)cur->data); - purple_privacy_permit_remove(account, cur->data, TRUE); + purple_account_privacy_permit_remove(account, cur->data, TRUE); } } } /* Deny list */ - next = account->deny; + next = purple_account_privacy_get_denied(account); while (next != NULL) { cur = next; next = next->next; if (!aim_ssi_itemlist_finditem(&od->ssi.local, NULL, cur->data, deny_entry_type)) { purple_debug_info("oscar", "ssi: removing deny %s from local list\n", (const char *)cur->data); - purple_privacy_deny_remove(account, cur->data, TRUE); + purple_account_privacy_deny_remove(account, cur->data, TRUE); } } @@ -4016,11 +4017,11 @@ case AIM_SSI_TYPE_PERMIT: { /* Permit buddy (unless we're on ICQ) */ if (!od->icq && curitem->name) { - for (cur = account->permit; (cur && oscar_util_name_compare(curitem->name, cur->data)); cur = cur->next); + for (cur = purple_account_privacy_get_permitted(account); (cur && oscar_util_name_compare(curitem->name, cur->data)); cur = cur->next); if (!cur) { purple_debug_info("oscar", "ssi: adding permit buddy %s to local list\n", curitem->name); - purple_privacy_permit_add(account, curitem->name, TRUE); + purple_account_privacy_permit_add(account, curitem->name, TRUE); } } } break; @@ -4028,11 +4029,11 @@ case AIM_SSI_TYPE_ICQDENY: case AIM_SSI_TYPE_DENY: { /* Deny buddy */ if (curitem->type == deny_entry_type && curitem->name) { - for (cur = account->deny; (cur && oscar_util_name_compare(curitem->name, cur->data)); cur = cur->next); + for (cur = purple_account_privacy_get_denied(account); (cur && oscar_util_name_compare(curitem->name, cur->data)); cur = cur->next); if (!cur) { purple_debug_info("oscar", "ssi: adding deny buddy %s to local list\n", curitem->name); - purple_privacy_deny_add(account, curitem->name, TRUE); + purple_account_privacy_deny_add(account, curitem->name, TRUE); } } } break;
--- a/libpurple/protocols/sametime/sametime.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/sametime/sametime.c Mon Jun 17 23:39:13 2013 +0530 @@ -41,7 +41,6 @@ #include "mime.h" #include "notify.h" #include "plugin.h" -#include "privacy.h" #include "prpl.h" #include "request.h" #include "util.h" @@ -1634,7 +1633,7 @@ PurpleConnection *gc; PurpleAccount *acct; struct mwPrivacyInfo *privacy; - GSList *l, **ll; + GSList *list; guint count; DEBUG_INFO("privacy information set from server\n"); @@ -1653,16 +1652,25 @@ privacy = mwSession_getPrivacyInfo(session); count = privacy->count; - ll = (privacy->deny)? &acct->deny: &acct->permit; - for(l = *ll; l; l = l->next) g_free(l->data); - g_slist_free(*ll); - l = *ll = NULL; - - while(count--) { - struct mwUserItem *u = privacy->users + count; - l = g_slist_prepend(l, g_strdup(u->id)); + if (privacy->deny) { + while ((list = purple_account_privacy_get_denied(acct))) { + g_free(list->data); + purple_account_privacy_deny_remove(acct, list->data, TRUE); + } + while (count--) { + struct mwUserItem *u = privacy->users + count; + purple_account_privacy_deny_add(acct, u->id, TRUE); + } + } else { + while ((list = purple_account_privacy_get_permitted(acct))) { + g_free(list->data); + purple_account_privacy_permit_remove(acct, list->data, TRUE); + } + while (count--) { + struct mwUserItem *u = privacy->users + count; + purple_account_privacy_permit_add(acct, u->id, TRUE); + } } - *ll = l; } @@ -4604,25 +4612,25 @@ g_return_if_fail(session != NULL); switch(purple_account_get_privacy_type(acct)) { - case PURPLE_PRIVACY_DENY_USERS: - DEBUG_INFO("PURPLE_PRIVACY_DENY_USERS\n"); - privacy_fill(&privacy, acct->deny); + case PURPLE_ACCOUNT_PRIVACY_DENY_USERS: + DEBUG_INFO("PURPLE_ACCOUNT_PRIVACY_DENY_USERS\n"); + privacy_fill(&privacy, purple_account_privacy_get_denied(acct)); privacy.deny = TRUE; break; - case PURPLE_PRIVACY_ALLOW_ALL: - DEBUG_INFO("PURPLE_PRIVACY_ALLOW_ALL\n"); + case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL: + DEBUG_INFO("PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL\n"); privacy.deny = TRUE; break; - case PURPLE_PRIVACY_ALLOW_USERS: - DEBUG_INFO("PURPLE_PRIVACY_ALLOW_USERS\n"); - privacy_fill(&privacy, acct->permit); + case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS: + DEBUG_INFO("PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS\n"); + privacy_fill(&privacy, purple_account_privacy_get_permitted(acct)); privacy.deny = FALSE; break; - case PURPLE_PRIVACY_DENY_ALL: - DEBUG_INFO("PURPLE_PRIVACY_DENY_ALL\n"); + case PURPLE_ACCOUNT_PRIVACY_DENY_ALL: + DEBUG_INFO("PURPLE_ACCOUNT_PRIVACY_DENY_ALL\n"); privacy.deny = FALSE; break;
--- a/libpurple/protocols/simple/simple.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/simple/simple.c Mon Jun 17 23:39:13 2013 +0530 @@ -32,7 +32,6 @@ #include "dnsquery.h" #include "debug.h" #include "notify.h" -#include "privacy.h" #include "prpl.h" #include "plugin.h" #include "util.h" @@ -1455,7 +1454,7 @@ if(!watcher) { /* new subscription */ const gchar *acceptheader = sipmsg_find_header(msg, "Accept"); gboolean needsxpidf = FALSE; - if(!purple_privacy_check(sip->account, from)) { + if(!purple_account_privacy_check(sip->account, from)) { send_sip_response(sip->gc, msg, 202, "Ok", NULL); goto privend; }
--- a/libpurple/protocols/yahoo/libymsg.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/yahoo/libymsg.c Mon Jun 17 23:39:13 2013 +0530 @@ -33,7 +33,6 @@ #include "debug.h" #include "network.h" #include "notify.h" -#include "privacy.h" #include "prpl.h" #include "proxy.h" #include "request.h" @@ -575,7 +574,7 @@ } else { /* This buddy is on the ignore list (and therefore in no group) */ purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n", purple_account_get_username(account), norm_bud); - purple_privacy_deny_add(account, norm_bud, 1); + purple_account_privacy_deny_add(account, norm_bud, 1); } g_free(norm_bud); @@ -738,7 +737,7 @@ for (bud = buddies; bud && *bud; bud++) { /* The server is already ignoring the user */ got_serv_list = TRUE; - purple_privacy_deny_add(account, *bud, 1); + purple_account_privacy_deny_add(account, *bud, 1); } g_strfreev(buddies); @@ -747,12 +746,12 @@ } if (got_serv_list && - ((purple_account_get_privacy_type(account) != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && - (purple_account_get_privacy_type(account) != PURPLE_PRIVACY_DENY_ALL) && - (purple_account_get_privacy_type(account) != PURPLE_PRIVACY_ALLOW_USERS))) + ((purple_account_get_privacy_type(account) != PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST) && + (purple_account_get_privacy_type(account) != PURPLE_ACCOUNT_PRIVACY_DENY_ALL) && + (purple_account_get_privacy_type(account) != PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS))) { - purple_account_set_privacy_type(account, PURPLE_PRIVACY_DENY_USERS); - purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", + purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS); + purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_ACCOUNT_PRIVACY_DENY_USERS.\n", purple_account_get_username(account)); } @@ -820,7 +819,7 @@ } if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) - && (purple_privacy_check(account, from))) + && (purple_account_privacy_check(account, from))) { char *fed_from = from; switch (fed) { @@ -1044,7 +1043,7 @@ { PurpleWhiteboard *wb; - if (!purple_privacy_check(account, im->from)) { + if (!purple_account_privacy_check(account, im->from)) { purple_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); g_free(im->fed_from); @@ -1090,7 +1089,7 @@ continue; } - if (!purple_privacy_check(account, im->fed_from)) { + if (!purple_account_privacy_check(account, im->fed_from)) { purple_debug_info("yahoo", "Message from %s dropped.\n", im->fed_from); return; } @@ -1409,7 +1408,7 @@ if (add_req->id && add_req->who) { char *alias = NULL, *dec_msg = NULL; - if (!purple_privacy_check(account, add_req->who)) + if (!purple_account_privacy_check(account, add_req->who)) { purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", add_req->who); @@ -1482,7 +1481,7 @@ if (add_req->id && add_req->who) { char *dec_msg = NULL; - if (!purple_privacy_check(account, add_req->who)) { + if (!purple_account_privacy_check(account, add_req->who)) { purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", add_req->who); yahoo_buddy_add_deny_cb(NULL, add_req); @@ -2110,7 +2109,7 @@ static void keep_buddy(PurpleBuddy *b) { - purple_privacy_deny_remove(purple_buddy_get_account(b), + purple_account_privacy_deny_remove(purple_buddy_get_account(b), purple_buddy_get_name(b), 1); } @@ -2944,7 +2943,7 @@ purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); return; } - if (!purple_privacy_check(account, who)) { + if (!purple_account_privacy_check(account, who)) { purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", purple_account_get_username(account), who); return; @@ -4937,7 +4936,7 @@ return; fed_bname = bname = purple_buddy_get_name(buddy); - if (!purple_privacy_check(purple_connection_get_account(gc), bname)) + if (!purple_account_privacy_check(purple_connection_get_account(gc), bname)) return; fed = yahoo_get_federation_from_name(bname); @@ -5097,16 +5096,16 @@ switch (purple_account_get_privacy_type(account)) { - case PURPLE_PRIVACY_ALLOW_ALL: - for (deny = account->deny; deny; deny = deny->next) + case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL: + for (deny = purple_account_privacy_get_denied(account); deny; deny = deny->next) yahoo_rem_deny(gc, deny->data); break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - case PURPLE_PRIVACY_ALLOW_USERS: - case PURPLE_PRIVACY_DENY_USERS: - case PURPLE_PRIVACY_DENY_ALL: - for (deny = account->deny; deny; deny = deny->next) + case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST: + case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS: + case PURPLE_ACCOUNT_PRIVACY_DENY_USERS: + case PURPLE_ACCOUNT_PRIVACY_DENY_ALL: + for (deny = purple_account_privacy_get_denied(account); deny; deny = deny->next) yahoo_add_deny(gc, deny->data); break; }
--- a/libpurple/protocols/yahoo/yahoo_doodle.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/yahoo/yahoo_doodle.c Mon Jun 17 23:39:13 2013 +0530 @@ -33,7 +33,6 @@ #include "cmds.h" #include "debug.h" #include "notify.h" -#include "privacy.h" #include "prpl.h" #include "proxy.h" #include "request.h"
--- a/libpurple/protocols/yahoo/yahoo_picture.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/yahoo/yahoo_picture.c Mon Jun 17 23:39:13 2013 +0530 @@ -28,7 +28,6 @@ #include "accountopt.h" #include "blist.h" #include "debug.h" -#include "privacy.h" #include "prpl.h" #include "proxy.h" #include "util.h" @@ -113,7 +112,7 @@ if (!who) return; - if (!purple_privacy_check(purple_connection_get_account(gc), who)) { + if (!purple_account_privacy_check(purple_connection_get_account(gc), who)) { purple_debug_info("yahoo", "Picture packet from %s dropped.\n", who); return; }
--- a/libpurple/protocols/yahoo/yahoochat.c Mon Jun 17 21:59:32 2013 +0530 +++ b/libpurple/protocols/yahoo/yahoochat.c Mon Jun 17 23:39:13 2013 +0530 @@ -33,7 +33,6 @@ #endif /* HAVE_CONFIG_H */ #include "debug.h" -#include "privacy.h" #include "prpl.h" #include "conversation.h" @@ -181,7 +180,7 @@ return; } - if (!purple_privacy_check(account, who) || + if (!purple_account_privacy_check(account, who) || (purple_account_get_bool(account, "ignore_invites", FALSE))) { purple_debug_info("yahoo", @@ -231,7 +230,7 @@ break; } } - if (!purple_privacy_check(purple_connection_get_account(gc), who)) + if (!purple_account_privacy_check(purple_connection_get_account(gc), who)) { g_free(room); g_free(msg); @@ -589,9 +588,9 @@ yahoo_chat_add_users(PURPLE_CONV_CHAT(c), members); } - if (account->deny && c) { + if (purple_account_privacy_get_denied(account) && c) { PurpleConversationUiOps *ops = purple_conversation_get_ui_ops(c); - for (l = account->deny; l != NULL; l = l->next) { + for (l = purple_account_privacy_get_denied(account); l != NULL; l = l->next) { for (roomies = members; roomies; roomies = roomies->next) { if (!purple_utf8_strcasecmp((char *)l->data, roomies->data)) { purple_debug_info("yahoo", "Ignoring room member %s in room %s\n" , (char *)roomies->data, room ? room : ""); @@ -729,7 +728,7 @@ if (room && who) { GHashTable *components; - if (!purple_privacy_check(account, who) || + if (!purple_account_privacy_check(account, who) || (purple_account_get_bool(account, "ignore_invites", FALSE))) { purple_debug_info("yahoo", "Invite to room %s from %s has been dropped.\n", room, who);