gobjectification: d4594f5e: Fixed more Group casting

aluink at soc.pidgin.im aluink at soc.pidgin.im
Sun Jul 19 14:35:24 EDT 2009


-----------------------------------------------------------------
Revision: d4594f5e09c6881285561af9d7798f33e4b48dab
Ancestor: 39364b2bb1e8f41220696e7b4bd93886fd11a116
Author: aluink at soc.pidgin.im
Date: 2009-07-17T16:16:05
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/d4594f5e09c6881285561af9d7798f33e4b48dab

Modified files:
        libpurple/blist.c libpurple/group.c

ChangeLog: 

Fixed more Group casting

-------------- next part --------------
============================================================
--- libpurple/blist.c	eae3e2bb17edaa994febf88cc06a1ba8d781f88e
+++ libpurple/blist.c	d2d5e60a4531bed1cc0cc93bddd1b35cea50c065
@@ -421,8 +421,6 @@ void purple_blist_set_visible(gboolean s
 		ops->set_visible(show);
 }
 
-
-
 gboolean
 purple_strings_are_different(const char *one, const char *two)
 {
@@ -615,7 +613,7 @@ void purple_blist_add_contact(PurpleCont
 
 	if (node && (PURPLE_IS_CONTACT(node) ||
 				PURPLE_IS_CHAT(node)))
-		g = (PurpleGroup*)node->parent;
+		g = PURPLE_GROUP(node->parent);
 	else if (group)
 		g = group;
 	else {
@@ -669,7 +667,7 @@ void purple_blist_add_contact(PurpleCont
 					g_hash_table_replace(account_buddies, hb2, b);
 
 					if (purple_account_get_connection(purple_buddy_get_account(b)))
-						serv_move_buddy(b, (PurpleGroup *)cnode->parent, g);
+						serv_move_buddy(b, PURPLE_GROUP(cnode->parent), g);
 				} else {
 					/* If it's already in the group, then we don't move it there,
 					 * we just remove it from the contact.*/
@@ -680,7 +678,7 @@ void purple_blist_add_contact(PurpleCont
 					g_free(hb->name);
 					g_free(hb);
 					if (purple_account_get_connection(purple_buddy_get_account(b)))
-						purple_account_remove_buddy(purple_buddy_get_account(b), b, (PurpleGroup *)cnode->parent);
+						purple_account_remove_buddy(purple_buddy_get_account(b), b, PURPLE_GROUP(cnode->parent));
 
 					/* Since we removed it from the contact, the cnode might be empty */
 					if (!cnode->child->next)
@@ -878,7 +876,7 @@ void purple_blist_remove_chat(PurpleChat
 
 	node = PURPLE_BLIST_NODE(chat);
 	gnode = node->parent;
-	group = (PurpleGroup *)gnode;
+	group = PURPLE_GROUP(gnode);
 
 	if (gnode != NULL)
 	{
@@ -942,10 +940,11 @@ PurpleGroup *purple_find_group(const cha
 	PurpleBlistNode *node;
 
 	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
-	
+
+	node = purple_blist_get_root();	
 	for (; node != NULL; node = node->next) {
-		if (!purple_utf8_strcasecmp(((PurpleGroup *)node)->name, name))
-			return (PurpleGroup *)node;
+		if (!purple_utf8_strcasecmp((PURPLE_GROUP(node))->name, name))
+			return PURPLE_GROUP(node);
 	}
 
 	return NULL;
@@ -1040,7 +1039,7 @@ void purple_blist_add_account(PurpleAcco
 							recompute = TRUE;
 							((PurpleContact*)cnode)->currentsize++;
 							if (((PurpleContact*)cnode)->currentsize == 1)
-								((PurpleGroup*)gnode)->currentsize++;
+								(PURPLE_GROUP(gnode))->currentsize++;
 							ops->update(bnode);
 						}
 					}
@@ -1051,8 +1050,8 @@ void purple_blist_add_account(PurpleAcco
 					}
 			} else if (PURPLE_IS_CHAT(cnode) &&
 					((PurpleChat*)cnode)->account == account) {
-				((PurpleGroup *)gnode)->online++;
-				((PurpleGroup *)gnode)->currentsize++;
+				(PURPLE_GROUP(gnode))->online++;
+				(PURPLE_GROUP(gnode))->currentsize++;
 				ops->update(cnode);
 			}
 		}
@@ -1076,7 +1075,7 @@ void purple_blist_remove_account(PurpleA
 		if (!PURPLE_IS_GROUP(gnode))
 			continue;
 
-		group = (PurpleGroup *)gnode;
+		group = PURPLE_GROUP(gnode);
 
 		for (cnode = gnode->child; cnode; cnode = cnode->next) {
 			if (PURPLE_IS_CONTACT(cnode)) {
@@ -1181,7 +1180,7 @@ void purple_blist_add_chat(PurpleChat *c
 					purple_blist_node_first_child(PURPLE_BLIST_NODE(list)));
 		}
 	} else {
-		group = (PurpleGroup*)node->parent;
+		group = PURPLE_GROUP(node->parent);
 	}
 
 
@@ -1213,10 +1212,10 @@ void purple_blist_add_chat(PurpleChat *c
 		cnode->prev = node;
 		cnode->parent = node->parent;
 		node->next = cnode;
-		((PurpleGroup *)node->parent)->totalsize++;
+		(PURPLE_GROUP(node->parent))->totalsize++;
 		if (purple_account_is_connected(chat->account)) {
-			((PurpleGroup *)node->parent)->online++;
-			((PurpleGroup *)node->parent)->currentsize++;
+			(PURPLE_GROUP(node->parent))->online++;
+			(PURPLE_GROUP(node->parent))->currentsize++;
 		}
 	} else {
 		if ((PURPLE_BLIST_NODE(group))->child)
@@ -1264,7 +1263,7 @@ void purple_blist_add_buddy(PurpleBuddy 
 
 	if (node && PURPLE_IS_BUDDY(node)) {
 		c = (PurpleContact*)node->parent;
-		g = (PurpleGroup*)node->parent->parent;
+		g = PURPLE_GROUP(node->parent->parent);
 	} else if (contact) {
 		c = contact;
 		g = PURPLE_GROUP(PURPLE_BLIST_NODE(c)->parent);
@@ -1288,18 +1287,18 @@ void purple_blist_add_buddy(PurpleBuddy 
 		if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
 			((PurpleContact*)bnode->parent)->online--;
 			if (((PurpleContact*)bnode->parent)->online == 0)
-				((PurpleGroup*)bnode->parent->parent)->online--;
+				(PURPLE_GROUP(bnode->parent->parent))->online--;
 		}
 		if (purple_account_is_connected(purple_buddy_get_account(buddy))) {
 			((PurpleContact*)bnode->parent)->currentsize--;
 			if (((PurpleContact*)bnode->parent)->currentsize == 0)
-				((PurpleGroup*)bnode->parent->parent)->currentsize--;
+				(PURPLE_GROUP(bnode->parent->parent))->currentsize--;
 		}
 		((PurpleContact*)bnode->parent)->totalsize--;
 		/* the group totalsize will be taken care of by remove_contact below */
 
 		if (bnode->parent->parent != PURPLE_BLIST_NODE(g))
-			serv_move_buddy(buddy, (PurpleGroup *)bnode->parent->parent, g);
+			serv_move_buddy(buddy, PURPLE_GROUP(bnode->parent->parent), g);
 
 		if (bnode->next)
 			bnode->next->prev = bnode->prev;
@@ -1473,7 +1472,7 @@ purple_chat_get_group(PurpleChat *chat)
 {
 	g_return_val_if_fail(chat != NULL, NULL);
 
-	return (PurpleGroup *)((PURPLE_BLIST_NODE(chat))->parent);
+	return PURPLE_GROUP(((PURPLE_BLIST_NODE(chat))->parent));
 }
 
 static void
============================================================
--- libpurple/group.c	2032914afd2ae21abc0be757905dc36b92a152ac
+++ libpurple/group.c	8b2cc9f79fcba27d4d09b87de649c8351dc72836
@@ -40,7 +40,7 @@ group_to_xmlnode(PurpleBlistNode *gnode)
 	PurpleGroup *group;
 	PurpleBlistNode *cnode;
 
-	group = (PurpleGroup *)gnode;
+	group = PURPLE_GROUP(gnode);
 
 	node = xmlnode_new("group");
 	xmlnode_set_attrib(node, "name", group->name);
@@ -135,7 +135,7 @@ PurpleGroup *purple_buddy_get_group(Purp
 	if ((PURPLE_BLIST_NODE(buddy))->parent == NULL)
 		return NULL;
 
-	return (PurpleGroup *)((PURPLE_BLIST_NODE(buddy))->parent->parent);
+	return PURPLE_GROUP(PURPLE_BLIST_NODE(buddy)->parent->parent);
 }
 
 void


More information about the Commits mailing list