/soc/2013/ankitkv/gobjectification: cfb2f856a5d0: Refactored prp...
Ankit Vani
a at nevitus.org
Mon Jun 17 14:09:25 EDT 2013
Changeset: cfb2f856a5d02a2194942fbcfa50085bd4dcad27
Author: Ankit Vani <a at nevitus.org>
Date: 2013-06-17 23:39 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/cfb2f856a5d0
Description:
Refactored prpls according to the changed PurpleAccount API
diffstat:
libpurple/account.h | 4 +-
libpurple/protocols/bonjour/jabber.c | 2 +-
libpurple/protocols/jabber/google/google_roster.c | 10 +-
libpurple/protocols/jabber/jabber.c | 19 ++--
libpurple/protocols/msn/contact.c | 8 +-
libpurple/protocols/msn/msn.c | 4 +-
libpurple/protocols/msn/userlist.c | 16 ++--
libpurple/protocols/myspace/myspace.c | 9 +-
libpurple/protocols/novell/novell.c | 87 ++++++++++++----------
libpurple/protocols/oscar/oscar.c | 29 +++---
libpurple/protocols/sametime/sametime.c | 50 +++++++-----
libpurple/protocols/simple/simple.c | 3 +-
libpurple/protocols/yahoo/libymsg.c | 45 +++++------
libpurple/protocols/yahoo/yahoo_doodle.c | 1 -
libpurple/protocols/yahoo/yahoo_picture.c | 3 +-
libpurple/protocols/yahoo/yahoochat.c | 11 +-
libpurple/protocols/zephyr/zephyr.c | 1 -
17 files changed, 158 insertions(+), 144 deletions(-)
diffs (truncated from 1049 to 300 lines):
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -862,7 +862,7 @@ void purple_account_privacy_deny(PurpleA
* 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 @@ GSList *purple_account_privacy_get_permi
* 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);
diff --git a/libpurple/protocols/bonjour/jabber.c b/libpurple/protocols/bonjour/jabber.c
--- a/libpurple/protocols/bonjour/jabber.c
+++ b/libpurple/protocols/bonjour/jabber.c
@@ -1303,7 +1303,7 @@ check_if_blocked(PurpleBuddy *pb)
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);
diff --git a/libpurple/protocols/jabber/google/google_roster.c b/libpurple/protocols/jabber/google/google_roster.c
--- a/libpurple/protocols/jabber/google/google_roster.c
+++ b/libpurple/protocols/jabber/google/google_roster.c
@@ -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 @@ gboolean jabber_google_roster_incoming(J
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 @@ gboolean jabber_google_roster_incoming(J
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);
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -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 @@ void jabber_blocklist_parse_push(JabberS
xmlnode *item;
PurpleAccount *account;
gboolean is_block;
+ GSList *deny;
if (!jabber_is_own_account(js, from)) {
xmlnode *error, *x;
@@ -1824,8 +1824,8 @@ void jabber_blocklist_parse_push(JabberS
/* 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 @@ void jabber_blocklist_parse_push(JabberS
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 @@ static void jabber_blocklist_parse(Jabbe
{
xmlnode *blocklist, *item;
PurpleAccount *account;
+ GSList *deny;
blocklist = xmlnode_get_child_with_namespace(packet,
"blocklist", NS_SIMPLE_BLOCKING);
@@ -1873,19 +1874,19 @@ static void jabber_blocklist_parse(Jabbe
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);
}
}
diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c
--- a/libpurple/protocols/msn/contact.c
+++ b/libpurple/protocols/msn/contact.c
@@ -1664,10 +1664,10 @@ msn_del_contact_from_list_read_cb(MsnSoa
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 @@ msn_add_contact_to_list_read_cb(MsnSoapM
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);
}
}
}
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
--- a/libpurple/protocols/msn/msn.c
+++ b/libpurple/protocols/msn/msn.c
@@ -814,8 +814,8 @@ msn_send_privacy(PurpleConnection *gc)
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");
diff --git a/libpurple/protocols/msn/userlist.c b/libpurple/protocols/msn/userlist.c
--- a/libpurple/protocols/msn/userlist.c
+++ b/libpurple/protocols/msn/userlist.c
@@ -59,8 +59,8 @@ msn_accept_add_cb(const char *message, g
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 @@ msn_got_lst_user(MsnSession *session, Ms
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 @@ msn_userlist_load(MsnSession *session)
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);
diff --git a/libpurple/protocols/myspace/myspace.c b/libpurple/protocols/myspace/myspace.c
--- a/libpurple/protocols/myspace/myspace.c
+++ b/libpurple/protocols/myspace/myspace.c
@@ -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 @@ msim_add_contact_from_server_cb(MsimSess
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 @@ msim_login(PurpleAccount *acct)
{
PurpleConnection *gc;
const gchar *host;
+ GSList *deny;
int port;
g_return_if_fail(acct != NULL);
@@ -2195,8 +2194,8 @@ msim_login(PurpleAccount *acct)
* 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"),
diff --git a/libpurple/protocols/novell/novell.c b/libpurple/protocols/novell/novell.c
--- a/libpurple/protocols/novell/novell.c
+++ b/libpurple/protocols/novell/novell.c
@@ -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 @@ static void
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 @@ static void
gc = purple_account_get_connection(user->client_data);
display_id = nm_user_record_get_display_id(user_record);
+ account = purple_connection_get_account(gc);
More information about the Commits
mailing list