/soc/2013/ankitkv/gobjectification: d88ae5b94191: Revert all the...

Ankit Vani a at nevitus.org
Mon Jan 20 16:59:39 EST 2014


Changeset: d88ae5b94191fc3d8f715c58476c3db7e3e45591
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2014-01-21 01:28 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/d88ae5b94191

Description:

Revert all the migration stuff

diffstat:

 ChangeLog.API             |   4 --
 libpurple/accounts.c      |  33 +++++----------------
 libpurple/buddylist.c     |  70 +++++++++++-----------------------------------
 libpurple/pounce.c        |  27 +----------------
 libpurple/prefs.c         |  25 ++--------------
 libpurple/prefs.h         |   5 +++
 libpurple/savedstatuses.c |  28 +++---------------
 libpurple/smiley.c        |   9 +-----
 libpurple/util.c          |  46 ------------------------------
 libpurple/util.h          |  14 ---------
 10 files changed, 42 insertions(+), 219 deletions(-)

diffs (truncated from 674 to 300 lines):

diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -161,7 +161,6 @@ version 3.0.0 (??/??/????):
 		* purple_roomlist_room_set_expanded_once
 		* purple_roomlist_set_proto_data
 		* purple_roomlist_set_ui_data
-		* purple_version_strcmp
 		* purple_whiteboard_get_account
 		* purple_whiteboard_get_draw_list
 		* purple_whiteboard_set_draw_list
@@ -311,8 +310,6 @@ version 3.0.0 (??/??/????):
 		* purple_plugins_find_with_id renamed to purple_plugins_find_plugin
 		* purple_plugins_find_with_filename renamed to
 		  purple_plugins_find_by_filename
-		* Protocol IDs are no longer equivalent to using plugin IDs of prpls.
-		  IDs for in-tree protocols no longer have the leading "prpl-".
 		* proto_chat_entry has been renamed to PurpleProtocolChatEntry
 		* PurpleRoomlist is now a GObject. Please see the documentation for
 		  details.
@@ -459,7 +456,6 @@ version 3.0.0 (??/??/????):
 		* purple_plugins_unload_all
 		* purple_pounces_load
 		* purple_prefs_set_generic
-		* purple_prefs_update_old
 		* purple_presence_add_status
 		* purple_presence_add_list
 		* PurplePresenceContext
diff --git a/libpurple/accounts.c b/libpurple/accounts.c
--- a/libpurple/accounts.c
+++ b/libpurple/accounts.c
@@ -32,8 +32,6 @@
 #include "network.h"
 #include "pounce.h"
 
-#define ACCOUNTS_XML_VERSION "1.1"
-
 static PurpleAccountUiOps *account_ui_ops = NULL;
 
 static GList   *accounts = NULL;
@@ -50,7 +48,7 @@ accounts_to_xmlnode(void)
 	GList *cur;
 
 	node = purple_xmlnode_new("account");
-	purple_xmlnode_set_attrib(node, "version", ACCOUNTS_XML_VERSION);
+	purple_xmlnode_set_attrib(node, "version", "1.0");
 
 	for (cur = purple_accounts_get_all(); cur != NULL; cur = cur->next)
 	{
@@ -461,18 +459,17 @@ parse_current_error(PurpleXmlNode *node,
 }
 
 static PurpleAccount *
-parse_account(PurpleXmlNode *node, const gchar *version)
+parse_account(PurpleXmlNode *node)
 {
 	PurpleAccount *ret;
 	PurpleXmlNode *child;
-	char *read_proto = NULL, *protocol_id;
+	char *protocol_id = NULL;
 	char *name = NULL;
 	char *data;
 
 	child = purple_xmlnode_get_child(node, "protocol");
 	if (child != NULL)
-		read_proto = purple_xmlnode_get_data(child);
-	protocol_id = read_proto;
+		protocol_id = purple_xmlnode_get_data(child);
 
 	child = purple_xmlnode_get_child(node, "name");
 	if (child != NULL)
@@ -485,24 +482,16 @@ parse_account(PurpleXmlNode *node, const
 			name = purple_xmlnode_get_data(child);
 	}
 
-	if ((read_proto == NULL) || (name == NULL))
+	if ((protocol_id == NULL) || (name == NULL))
 	{
-		g_free(read_proto);
+		g_free(protocol_id);
 		g_free(name);
 		return NULL;
 	}
 
-	if (purple_version_strcmp(version, "1.1") < 0) {
-		if (!strncmp(protocol_id, "prpl-", 5)) {
-			purple_debug_info("accounts", "accounts.xml: Migrating account %s "
-					"from version %s to 1.1\n", name, version);
-			protocol_id += 5;
-		}
-	}
-
 	ret = purple_account_new(name, protocol_id);
 	g_free(name);
-	g_free(read_proto);
+	g_free(protocol_id);
 
 	/* Read the alias */
 	child = purple_xmlnode_get_child(node, "alias");
@@ -593,7 +582,6 @@ static void
 load_accounts(void)
 {
 	PurpleXmlNode *node, *child;
-	const char *version;
 
 	accounts_loaded = TRUE;
 
@@ -602,16 +590,11 @@ load_accounts(void)
 	if (node == NULL)
 		return;
 
-	version = purple_xmlnode_get_attrib(node, "version");
-	if (purple_version_strcmp(version, ACCOUNTS_XML_VERSION) > 0)
-		purple_debug_warning("accounts", "accounts.xml on disk is for a newer "
-				"version of libpurple");
-
 	for (child = purple_xmlnode_get_child(node, "account"); child != NULL;
 			child = purple_xmlnode_get_next_twin(child))
 	{
 		PurpleAccount *new_acct;
-		new_acct = parse_account(child, version);
+		new_acct = parse_account(child);
 		purple_accounts_add(new_acct);
 	}
 
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -34,8 +34,6 @@
 #include "util.h"
 #include "xmlnode.h"
 
-#define BLIST_XML_VERSION "1.1"
-
 #define PURPLE_BUDDY_LIST_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_BUDDY_LIST, PurpleBuddyListPrivate))
 
@@ -350,7 +348,7 @@ blist_to_xmlnode(void)
 	GList *cur;
 
 	node = purple_xmlnode_new("purple");
-	purple_xmlnode_set_attrib(node, "version", BLIST_XML_VERSION);
+	purple_xmlnode_set_attrib(node, "version", "1.0");
 
 	/* Write groups */
 	child = purple_xmlnode_new_child(node, "blist");
@@ -465,8 +463,7 @@ parse_setting(PurpleBlistNode *node, Pur
 }
 
 static void
-parse_buddy(PurpleGroup *group, PurpleContact *contact, PurpleXmlNode *bnode,
-		const char *version)
+parse_buddy(PurpleGroup *group, PurpleContact *contact, PurpleXmlNode *bnode)
 {
 	PurpleAccount *account;
 	PurpleBuddy *buddy;
@@ -480,26 +477,17 @@ parse_buddy(PurpleGroup *group, PurpleCo
 	if (!acct_name || !proto)
 		return;
 
+	account = purple_accounts_find(acct_name, proto);
+
+	if (!account)
+		return;
+
 	if ((x = purple_xmlnode_get_child(bnode, "name")))
 		name = purple_xmlnode_get_data(x);
 
 	if (!name)
 		return;
 
-	if (purple_version_strcmp(version, "1.1") < 0) {
-		if (!strncmp(proto, "prpl-", 5)) {
-			purple_debug_info("buddylist", "blist.xml: Migrating "
-					"buddy %s for account %s from version %s to 1.1\n",
-					name, acct_name, version);
-			proto += 5;
-		}
-	}
-
-	account = purple_accounts_find(acct_name, proto);
-
-	if (!account)
-		return;
-
 	if ((x = purple_xmlnode_get_child(bnode, "alias")))
 		alias = purple_xmlnode_get_data(x);
 
@@ -516,7 +504,7 @@ parse_buddy(PurpleGroup *group, PurpleCo
 }
 
 static void
-parse_contact(PurpleGroup *group, PurpleXmlNode *cnode, const char *version)
+parse_contact(PurpleGroup *group, PurpleXmlNode *cnode)
 {
 	PurpleContact *contact = purple_contact_new();
 	PurpleXmlNode *x;
@@ -533,7 +521,7 @@ parse_contact(PurpleGroup *group, Purple
 		if (x->type != PURPLE_XMLNODE_TYPE_TAG)
 			continue;
 		if (purple_strequal(x->name, "buddy"))
-			parse_buddy(group, contact, x, version);
+			parse_buddy(group, contact, x);
 		else if (purple_strequal(x->name, "setting"))
 			parse_setting(PURPLE_BLIST_NODE(contact), x);
 	}
@@ -544,7 +532,7 @@ parse_contact(PurpleGroup *group, Purple
 }
 
 static void
-parse_chat(PurpleGroup *group, PurpleXmlNode *cnode, const char *version)
+parse_chat(PurpleGroup *group, PurpleXmlNode *cnode)
 {
 	PurpleChat *chat;
 	PurpleAccount *account;
@@ -559,23 +547,14 @@ parse_chat(PurpleGroup *group, PurpleXml
 	if (!acct_name || !proto)
 		return;
 
-	if ((x = purple_xmlnode_get_child(cnode, "alias")))
-		alias = purple_xmlnode_get_data(x);
-
-	if (purple_version_strcmp(version, "1.1") < 0) {
-		if (!strncmp(proto, "prpl-", 5)) {
-			purple_debug_info("buddylist", "blist.xml: Migrating "
-					"chat %s for account %s from version %s to 1.1\n",
-					alias ? alias : "(no alias)", acct_name, version);
-			proto += 5;
-		}
-	}
-
 	account = purple_accounts_find(acct_name, proto);
 
 	if (!account)
 		return;
 
+	if ((x = purple_xmlnode_get_child(cnode, "alias")))
+		alias = purple_xmlnode_get_data(x);
+
 	components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 
 	for (x = purple_xmlnode_get_child(cnode, "component"); x; x = purple_xmlnode_get_next_twin(x)) {
@@ -599,7 +578,7 @@ parse_chat(PurpleGroup *group, PurpleXml
 }
 
 static void
-parse_group(PurpleXmlNode *groupnode, const char *version)
+parse_group(PurpleXmlNode *groupnode)
 {
 	const char *name = purple_xmlnode_get_attrib(groupnode, "name");
 	PurpleGroup *group;
@@ -619,9 +598,9 @@ parse_group(PurpleXmlNode *groupnode, co
 			parse_setting((PurpleBlistNode*)group, cnode);
 		else if (purple_strequal(cnode->name, "contact") ||
 				purple_strequal(cnode->name, "person"))
-			parse_contact(group, cnode, version);
+			parse_contact(group, cnode);
 		else if (purple_strequal(cnode->name, "chat"))
-			parse_chat(group, cnode, version);
+			parse_chat(group, cnode);
 	}
 }
 
@@ -629,7 +608,6 @@ static void
 load_blist(void)
 {
 	PurpleXmlNode *purple, *blist, *privacy;
-	const char *version;
 
 	blist_loaded = TRUE;
 
@@ -638,17 +616,12 @@ load_blist(void)
 	if (purple == NULL)
 		return;
 
-	version = purple_xmlnode_get_attrib(purple, "version");
-	if (purple_version_strcmp(version, BLIST_XML_VERSION) > 0)
-		purple_debug_warning("buddylist", "blist.xml on disk is for a newer "
-				"version of libpurple");
-
 	blist = purple_xmlnode_get_child(purple, "blist");
 	if (blist) {
 		PurpleXmlNode *groupnode;
 		for (groupnode = purple_xmlnode_get_child(blist, "group"); groupnode != NULL;
 				groupnode = purple_xmlnode_get_next_twin(groupnode)) {
-			parse_group(groupnode, version);
+			parse_group(groupnode);
 		}
 	}
 
@@ -668,15 +641,6 @@ load_blist(void)
 			if (!acct_name || !proto || !mode)
 				continue;
 
-			if (purple_version_strcmp(version, "1.1") < 0) {
-				if (!strncmp(proto, "prpl-", 5)) {
-					purple_debug_info("buddylist", "blist.xml: Migrating "
-							"privacy for account %s from version %s to 1.1\n",
-							acct_name, version);
-					proto += 5;



More information about the Commits mailing list