/soc/2013/ankitkv/gobjectification: 476c39afcaae: Refactored the...

Ankit Vani a at nevitus.org
Wed Jun 19 06:22:08 EDT 2013


Changeset: 476c39afcaae3fb956aaa7689fd77b62636204f6
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-06-19 15:44 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/476c39afcaae

Description:

Refactored the libpurple core to use the GObject-based PurpleAccount

diffstat:

 libpurple/blist.c       |  11 +++++------
 libpurple/core.c        |   2 --
 libpurple/dbus-useful.c |   1 +
 libpurple/server.c      |   5 ++---
 4 files changed, 8 insertions(+), 11 deletions(-)

diffs (109 lines):

diff --git a/libpurple/blist.c b/libpurple/blist.c
--- a/libpurple/blist.c
+++ b/libpurple/blist.c
@@ -30,7 +30,6 @@
 #include "notify.h"
 #include "pounce.h"
 #include "prefs.h"
-#include "privacy.h"
 #include "prpl.h"
 #include "server.h"
 #include "signals.h"
@@ -317,13 +316,13 @@ accountprivacy_to_xmlnode(PurpleAccount 
 	g_snprintf(buf, sizeof(buf), "%d", purple_account_get_privacy_type(account));
 	xmlnode_set_attrib(node, "mode", buf);
 
-	for (cur = account->permit; cur; cur = cur->next)
+	for (cur = purple_account_privacy_get_permitted(account); cur; cur = cur->next)
 	{
 		child = xmlnode_new_child(node, "permit");
 		xmlnode_insert_data(child, cur->data, -1);
 	}
 
-	for (cur = account->deny; cur; cur = cur->next)
+	for (cur = purple_account_privacy_get_denied(account); cur; cur = cur->next)
 	{
 		child = xmlnode_new_child(node, "block");
 		xmlnode_insert_data(child, cur->data, -1);
@@ -640,7 +639,7 @@ load_blist(void)
 				continue;
 
 			imode = atoi(mode);
-			purple_account_set_privacy_type(account, (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL));
+			purple_account_set_privacy_type(account, (imode != 0 ? imode : PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL));
 
 			for (x = anode->child; x; x = x->next) {
 				char *name;
@@ -649,11 +648,11 @@ load_blist(void)
 
 				if (purple_strequal(x->name, "permit")) {
 					name = xmlnode_get_data(x);
-					purple_privacy_permit_add(account, name, TRUE);
+					purple_account_privacy_permit_add(account, name, TRUE);
 					g_free(name);
 				} else if (purple_strequal(x->name, "block")) {
 					name = xmlnode_get_data(x);
-					purple_privacy_deny_add(account, name, TRUE);
+					purple_account_privacy_deny_add(account, name, TRUE);
 					g_free(name);
 				}
 			}
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -43,7 +43,6 @@
 #include "plugin.h"
 #include "pounce.h"
 #include "prefs.h"
-#include "privacy.h"
 #include "proxy.h"
 #include "savedstatuses.h"
 #include "signals.h"
@@ -172,7 +171,6 @@ purple_core_init(const char *ui)
 	purple_blist_init();
 	purple_log_init();
 	purple_network_init();
-	purple_privacy_init();
 	purple_pounces_init();
 	purple_proxy_init();
 	purple_dnsquery_init();
diff --git a/libpurple/dbus-useful.c b/libpurple/dbus-useful.c
--- a/libpurple/dbus-useful.c
+++ b/libpurple/dbus-useful.c
@@ -2,6 +2,7 @@
 #include <glib.h>
 
 #include "dbus-useful.h"
+#include "accounts.h"
 #include "conversation.h"
 #include "util.h"
 
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -30,7 +30,6 @@
 #include "log.h"
 #include "notify.h"
 #include "prefs.h"
-#include "privacy.h"
 #include "prpl.h"
 #include "request.h"
 #include "signals.h"
@@ -560,7 +559,7 @@ void serv_got_im(PurpleConnection *gc, c
 	 */
 	flags |= PURPLE_MESSAGE_RECV;
 
-	if (!purple_privacy_check(account, who)) {
+	if (!purple_account_privacy_check(account, who)) {
 		purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg",
 				account, who, msg, flags, (unsigned int)mtime);
 		return;
@@ -778,7 +777,7 @@ void serv_got_chat_invite(PurpleConnecti
 	g_return_if_fail(who != NULL);
 
 	account = purple_connection_get_account(gc);
-	if (!purple_privacy_check(account, who)) {
+	if (!purple_account_privacy_check(account, who)) {
 		purple_signal_emit(purple_conversations_get_handle(), "chat-invite-blocked",
 				account, who, name, message, data);
 		return;



More information about the Commits mailing list