gobjectification: ef33a236: Externalized purplebuddylist

aluink at soc.pidgin.im aluink at soc.pidgin.im
Wed Jun 17 22:45:32 EDT 2009


-----------------------------------------------------------------
Revision: ef33a23645523ad8997f701e0cff6bd8f1a2bdd9
Ancestor: d18092473b4d9d6e95c12c1d4ad0dff3306271c9
Author: aluink at soc.pidgin.im
Date: 2009-06-18T01:34:30
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/ef33a23645523ad8997f701e0cff6bd8f1a2bdd9

Modified files:
        libpurple/blist-node.c libpurple/blist.c libpurple/blist.h
        libpurple/buddy.c libpurple/chat.c libpurple/contact.c
        libpurple/group.c

ChangeLog: 

Externalized purplebuddylist

-------------- next part --------------
============================================================
--- libpurple/blist-node.c	f2ad7fe515dcdce498d66d7095e6144be5da8ebf
+++ libpurple/blist-node.c	16a8a85a3bbccef21285847d7720542d36835ec9
@@ -153,7 +153,7 @@ purple_blist_update_node_icon(PurpleBlis
   g_return_if_fail(node != NULL);
 
   if (ops && ops->update)
-    ops->update(purple_blist_get_list(), node);
+    ops->update(purplebuddylist, node);
 }
 
 void purple_blist_add_chat(PurpleChat *chat, PurpleGroup *group, PurpleBlistNode *node)
@@ -171,7 +171,7 @@ void purple_blist_add_chat(PurpleChat *c
 		/* Add group to blist if isn't already on it. Fixes #2752. */
 		if (!purple_find_group(group->name)) {
 			purple_blist_add_group(group,
-					purple_blist_get_last_sibling(purple_blist_get_list()->root));
+					purple_blist_get_last_sibling(purplebuddylist->root));
 		}
 	} else {
 		group = (PurpleGroup*)node->parent;
@@ -198,7 +198,7 @@ void purple_blist_add_chat(PurpleChat *c
 			cnode->parent->child = cnode->next;
 
 		if (ops && ops->remove)
-			ops->remove(purple_blist_get_list(), cnode);
+			ops->remove(purplebuddylist, cnode);
 		/* ops->remove() cleaned up the cnode's ui_data, so we need to
 		 * reinitialize it */
 		if (ops && ops->new_node)
@@ -236,7 +236,7 @@ void purple_blist_add_chat(PurpleChat *c
 	purple_blist_schedule_save();
 
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode *)cnode);
+		ops->update(purplebuddylist, (PurpleBlistNode *)cnode);
 
 	purple_signal_emit(purple_blist_get_handle(), "blist-node-added",
 			cnode);
@@ -275,7 +275,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 		/* Add group to blist if isn't already on it. Fixes #2752. */
 		if (!purple_find_group(g->name)) {
 			purple_blist_add_group(g,
-					purple_blist_get_last_sibling(purple_blist_get_list()->root));
+					purple_blist_get_last_sibling(purplebuddylist->root));
 		}
 		c = purple_contact_new();
 		purple_blist_add_contact(c, g,
@@ -309,7 +309,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 			bnode->parent->child = bnode->next;
 
 		if (ops && ops->remove)
-			ops->remove(purple_blist_get_list(), bnode);
+			ops->remove(purplebuddylist, bnode);
 
 		purple_blist_schedule_save();
 
@@ -318,7 +318,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 			hb->name = g_strdup(purple_normalize(buddy->account, buddy->name));
 			hb->account = buddy->account;
 			hb->group = bnode->parent->parent;
-			g_hash_table_remove(purple_blist_get_list()->buddies, hb);
+			g_hash_table_remove(purplebuddylist->buddies, hb);
 
 			account_buddies = g_hash_table_lookup(purple_blist_get_buddies_cache(), buddy->account);
 			g_hash_table_remove(account_buddies, hb);
@@ -332,7 +332,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 		} else {
 			purple_contact_invalidate_priority_buddy((PurpleContact*)bnode->parent);
 			if (ops && ops->update)
-				ops->update(purple_blist_get_list(), bnode->parent);
+				ops->update(purplebuddylist, bnode->parent);
 		}
 	}
 
@@ -367,7 +367,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 	hb->account = buddy->account;
 	hb->group = ((PurpleBlistNode*)buddy)->parent->parent;
 
-	g_hash_table_replace(purple_blist_get_list()->buddies, hb, buddy);
+	g_hash_table_replace(purplebuddylist->buddies, hb, buddy);
 
 	account_buddies = g_hash_table_lookup(purple_blist_get_buddies_cache(), buddy->account);
 
@@ -383,7 +383,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 	purple_blist_schedule_save();
 
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode*)buddy);
+		ops->update(purplebuddylist, (PurpleBlistNode*)buddy);
 
 	/* Signal that the buddy has been added */
 	purple_signal_emit(purple_blist_get_handle(), "buddy-added", buddy);
@@ -447,7 +447,7 @@ purple_blist_node_destroy(PurpleBlistNod
 	node->next   = NULL;
 	node->prev   = NULL;
 	if (ui_ops && ui_ops->remove)
-		ui_ops->remove(purple_blist_get_list(), node);
+		ui_ops->remove(purplebuddylist, node);
 
 	if (PURPLE_BLIST_NODE_IS_BUDDY(node))
 		purple_buddy_destroy((PurpleBuddy*)node);
============================================================
--- libpurple/blist.c	334e745de44806a8c54287ca85b1e06f4f72ca0b
+++ libpurple/blist.c	6864a498c29b33e946e5c40bfe2bb1c86b74d175
@@ -40,7 +40,7 @@ static PurpleBlistUiOps *blist_ui_ops = 
 
 static PurpleBlistUiOps *blist_ui_ops = NULL;
 
-static PurpleBuddyList *purplebuddylist = NULL;
+PurpleBuddyList *purplebuddylist = NULL;
 
 /**
  * A hash table used for efficient lookups of buddies by name.
@@ -87,12 +87,6 @@ purple_blist_buddies_cache_remove_accoun
 	g_hash_table_remove(buddies_cache, account);
 }
 
-PurpleBuddyList*
-purple_blist_get_list(void)
-{
-  return purplebuddylist;
-}
-
 GHashTable* 
 purple_blist_get_buddies_cache(void)
 {
============================================================
--- libpurple/blist.h	1e32736797585033d30e01130064724e5e965955
+++ libpurple/blist.h	e6041f13611ab774abfc611916302998b92ce1a8
@@ -257,7 +257,7 @@ struct _purple_hbuddy {
   PurpleBlistNode *group;
 };
 
-PurpleBuddyList* purple_blist_get_list(void);
+extern PurpleBuddyList* purplebuddylist;
 GHashTable* purple_blist_get_buddies_cache(void);
 guint purple_blist_get_save_timer(void);
 gboolean purple_blist_get_blist_loaded(void);
============================================================
--- libpurple/buddy.c	cb402e709299a42ecc929e46abfc9d6bcd031df7
+++ libpurple/buddy.c	6af89162c92ca26e2d32b05c472069606033921d
@@ -94,10 +94,10 @@ purple_blist_get_buddies()
 {
 	GSList *buddies = NULL;
 
-	if (!purple_blist_get_list())
+	if (!purplebuddylist)
 		return NULL;
 
-	g_hash_table_foreach(purple_blist_get_list()->buddies, append_buddy, &buddies);
+	g_hash_table_foreach(purplebuddylist->buddies, append_buddy, &buddies);
 	return buddies;
 }
 
@@ -152,7 +152,7 @@ purple_blist_update_buddy_status(PurpleB
 	 */
 	purple_contact_invalidate_priority_buddy(purple_buddy_get_contact(buddy));
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode *)buddy);
+		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 }
 
 void
@@ -177,14 +177,14 @@ void purple_blist_rename_buddy(PurpleBud
 	hb->name = g_strdup(purple_normalize(buddy->account, buddy->name));
 	hb->account = buddy->account;
 	hb->group = ((PurpleBlistNode *)buddy)->parent->parent;
-	g_hash_table_remove(purple_blist_get_list()->buddies, hb);
+	g_hash_table_remove(purplebuddylist->buddies, hb);
 	
 	account_buddies = g_hash_table_lookup(purple_blist_get_buddies_cache(), buddy->account);
 	g_hash_table_remove(account_buddies, hb);
 
 	g_free(hb->name);
 	hb->name = g_strdup(purple_normalize(buddy->account, name));
-	g_hash_table_replace(purple_blist_get_list()->buddies, hb, buddy);
+	g_hash_table_replace(purplebuddylist->buddies, hb, buddy);
 
 	hb2 = g_new(struct _purple_hbuddy, 1);
 	hb2->name = g_strdup(hb->name);
@@ -199,7 +199,7 @@ void purple_blist_rename_buddy(PurpleBud
 	purple_blist_schedule_save();
 
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode *)buddy);
+		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 }
 
 void purple_blist_alias_buddy(PurpleBuddy *buddy, const char *alias)
@@ -231,7 +231,7 @@ void purple_blist_alias_buddy(PurpleBudd
 	purple_blist_schedule_save();
 
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode *)buddy);
+		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 
 	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
 											   buddy->account);
@@ -272,7 +272,7 @@ void purple_blist_server_alias_buddy(Pur
 	purple_blist_schedule_save();
 
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode *)buddy);
+		ops->update(purplebuddylist, (PurpleBlistNode *)buddy);
 
 	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name,
 											   buddy->account);
@@ -500,7 +500,7 @@ PurpleBuddy *purple_find_buddy_in_group(
 	struct _purple_hbuddy hb;
 	PurpleBuddy *ret;
 
-	g_return_val_if_fail(purple_blist_get_list() != NULL, NULL);
+	g_return_val_if_fail(purplebuddylist != NULL, NULL);
 	g_return_val_if_fail(account != NULL, NULL);
 	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
 
@@ -508,7 +508,7 @@ PurpleBuddy *purple_find_buddy_in_group(
 	hb.account = account;
 	hb.group = (PurpleBlistNode*)group;
 
-	ret = g_hash_table_lookup(purple_blist_get_list()->buddies, &hb);
+	ret = g_hash_table_lookup(purplebuddylist->buddies, &hb);
 	g_free(hb.name);
 
 	return ret;
============================================================
--- libpurple/chat.c	3183d861ddd88cb7e861d72304bf9b2c8b294aed
+++ libpurple/chat.c	650d6fd5448bb33ae3d305fd4d914c9227e8e153
@@ -158,7 +158,7 @@ void purple_blist_alias_chat(PurpleChat 
 	purple_blist_schedule_save();
 
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode *)chat);
+		ops->update(purplebuddylist, (PurpleBlistNode *)chat);
 
 	purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased",
 					 chat, old_alias);
@@ -236,7 +236,7 @@ purple_blist_find_chat(PurpleAccount *ac
 	GList *parts;
 	char *normname;
 
-	g_return_val_if_fail(purple_blist_get_list() != NULL, NULL);
+	g_return_val_if_fail(purplebuddylist != NULL, NULL);
 	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
 
 	if (!purple_account_is_connected(account))
@@ -249,7 +249,7 @@ purple_blist_find_chat(PurpleAccount *ac
 		return prpl_info->find_blist_chat(account, name);
 
 	normname = g_strdup(purple_normalize(account, name));
-	for (group = purple_blist_get_list()->root; group != NULL; group = group->next) {
+	for (group = purplebuddylist->root; group != NULL; group = group->next) {
 		for (node = group->child; node != NULL; node = node->next) {
 			if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
 
============================================================
--- libpurple/contact.c	aee5a71756fb1cf9f13a88939a5bf111aceeacd3
+++ libpurple/contact.c	cff020e56535acd584508133fa7acc717f5a733c
@@ -178,7 +178,7 @@ void purple_blist_alias_contact(PurpleCo
 	purple_blist_schedule_save();
 
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode *)contact);
+		ops->update(purplebuddylist, (PurpleBlistNode *)contact);
 
 	for(bnode = ((PurpleBlistNode *)contact)->child; bnode != NULL; bnode = bnode->next)
 	{
============================================================
--- libpurple/group.c	a00a480ba06e038f085790a88d89dacfb0d333fe
+++ libpurple/group.c	55b23ef42d49ff774c2949cfad4df0575ae6e1de
@@ -85,7 +85,7 @@ parse_group(xmlnode *groupnode)
 
 	group = purple_group_new(name);
 	purple_blist_add_group(group,
-			purple_blist_get_last_sibling(purple_blist_get_list()->root));
+			purple_blist_get_last_sibling(purplebuddylist->root));
 
 	for (cnode = groupnode->child; cnode; cnode = cnode->next) {
 		if (cnode->type != XMLNODE_TYPE_TAG)
@@ -183,7 +183,7 @@ void purple_blist_rename_group(PurpleGro
 
 	/* Update the UI */
 	if (ops && ops->update)
-		ops->update(purple_blist_get_list(), (PurpleBlistNode*)source);
+		ops->update(purplebuddylist, (PurpleBlistNode*)source);
 
 	/* Notify all PRPLs */
 	/* TODO: Is this condition needed?  Seems like it would always be TRUE */
@@ -249,10 +249,10 @@ PurpleGroup *purple_find_group(const cha
 {
 	PurpleBlistNode *node;
 
-	g_return_val_if_fail(purple_blist_get_list() != NULL, NULL);
+	g_return_val_if_fail(purplebuddylist != NULL, NULL);
 	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
 
-	for (node = purple_blist_get_list()->root; node != NULL; node = node->next) {
+	for (node = purplebuddylist->root; node != NULL; node = node->next) {
 		if (!purple_utf8_strcasecmp(((PurpleGroup *)node)->name, name))
 			return (PurpleGroup *)node;
 	}


More information about the Commits mailing list