changeset 22356:561729870929

Fix showing a contact's log, and don't access struct internals
author Richard Nelson <wabz@pidgin.im>
date Thu, 28 Feb 2008 11:25:49 +0000
parents d36ffc472585
children dcdd97400ab9
files finch/gntblist.c finch/gntlog.c
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Thu Feb 28 11:18:43 2008 +0000
+++ b/finch/gntblist.c	Thu Feb 28 11:25:49 2008 +0000
@@ -1308,7 +1308,7 @@
 }
 
 
-static void showlog_cb(PurpleBlistNode *node)
+static void showlog_cb(PurpleBlistNode *sel, PurpleBlistNode *node)
 {
 	PurpleLogType type;
 	PurpleAccount *account;
--- a/finch/gntlog.c	Thu Feb 28 11:18:43 2008 +0000
+++ b/finch/gntlog.c	Thu Feb 28 11:25:49 2008 +0000
@@ -419,7 +419,8 @@
 		return;
 	}
 
-	for (child = contact->node.child ; child ; child = child->next) {
+	for (child = purple_blist_node_get_first_child((PurpleBlistNode*)contact); child;
+			child = purple_blist_node_get_sibling_next(child)) {
 		if (!PURPLE_BLIST_NODE_IS_BUDDY(child))
 			continue;
 
@@ -429,17 +430,17 @@
 	}
 	logs = g_list_sort(logs, purple_log_compare);
 
-	if (contact->alias != NULL)
-		name = contact->alias;
-	else if (contact->priority != NULL)
-		name = purple_buddy_get_contact_alias(contact->priority);
+	name = purple_contact_get_alias(contact);
+	if (!name)
+		name = purple_buddy_get_contact_alias(purple_contact_get_priority_buddy(contact));
 
 	/* This will happen if the contact doesn't have an alias,
 	 * and none of the contact's buddies are online.
 	 * There is probably a better way to deal with this. */
 	if (name == NULL) {
-		if (contact->node.child != NULL && PURPLE_BLIST_NODE_IS_BUDDY(contact->node.child))
-			name = purple_buddy_get_contact_alias((PurpleBuddy *) contact->node.child);
+		child = purple_blist_node_get_first_child((PurpleBlistNode*)contact);
+		if (child != NULL && PURPLE_BLIST_NODE_IS_BUDDY(child))
+			name = purple_buddy_get_contact_alias((PurpleBuddy *)child);
 		if (name == NULL)
 			name = "";
 	}