diff src/gtkblist.c @ 10006:9baedaca25c7

[gaim-migrate @ 10923] This is a patch from Dave West. He says it makes people show up as online/offline for him. It crashes for me. I've changed some things from his patch, so I'm gonna commit it and let people work from there. I feel it's a step in the right direction. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 10 Sep 2004 04:09:36 +0000
parents bdec08a8fc5b
children a38881ec9c0f
line wrap: on
line diff
--- a/src/gtkblist.c	Fri Sep 10 02:51:22 2004 +0000
+++ b/src/gtkblist.c	Fri Sep 10 04:09:36 2004 +0000
@@ -3476,13 +3476,13 @@
 	/* XXX: why do we assume we have a buddy here? */
 	if (!gtknode) {
 #if 0
-		gaim_debug(GAIM_DEBUG_ERROR, "gtkblist", "buddy %s has no ui_data\n", ((GaimBuddy *)node)->name);
+		gaim_debug_error("gtkblist", "buddy %s has no ui_data\n", ((GaimBuddy *)node)->name);
 #endif
 		return FALSE;
 	}
 
 	if (!gtkblist) {
-		gaim_debug(GAIM_DEBUG_ERROR, "gtkblist", "get_iter_from_node was called, but we don't seem to have a blist\n");
+		gaim_debug_error("gtkblist", "get_iter_from_node was called, but we don't seem to have a blist\n");
 		return FALSE;
 	}
 
@@ -3766,10 +3766,11 @@
 	contact = (GaimContact*)node;
 	buddy = gaim_contact_get_priority_buddy(contact);
 
-	if(buddy && (buddy->present != GAIM_BUDDY_OFFLINE ||
-			(gaim_account_is_connected(buddy->account) &&
-			 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
-			gaim_blist_node_get_bool(node, "show_offline"))) {
+	if (buddy && (gaim_presence_is_online(buddy->presence) ||
+		(gaim_account_is_connected(buddy->account) &&
+			gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
+			gaim_blist_node_get_bool(node, "show_offline")))
+	{
 		GtkTreeIter iter;
 
 		if(!insert_node(list, node, &iter))
@@ -3819,14 +3820,15 @@
 	/* First things first, update the contact */
 	gaim_gtk_blist_update_contact(list, node->parent);
 
-	if(gtkparentnode->contact_expanded &&
-			(buddy->present != GAIM_BUDDY_OFFLINE ||
+	if (gtkparentnode->contact_expanded &&
+		(gaim_presence_is_online(buddy->presence) ||
 			(gaim_account_is_connected(buddy->account) &&
-			 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
-			gaim_blist_node_get_bool(node->parent, "show_offline"))) {
+				gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
+			gaim_blist_node_get_bool(node->parent, "show_offline")))
+	{
 		GtkTreeIter iter;
 
-		if(!insert_node(list, node, &iter))
+		if (!insert_node(list, node, &iter))
 			return;
 
 		buddy_node(buddy, &iter, node);
@@ -4556,7 +4558,7 @@
 		} else {
 			/* we're logging in or something... do nothing */
 			/* or should I make the blist? */
-			gaim_debug(GAIM_DEBUG_WARNING, "blist",
+			gaim_debug_warning("gtkblist",
 					   "docklet_toggle called with gaim_connections_get_all() "
 					   "but no blist!\n");
 		}
@@ -4599,6 +4601,19 @@
 	}
 }
 
+void gaim_gtk_blist_status_changed(GaimBuddy *buddy, GaimStatus *status)
+{
+	g_return_if_fail(buddy != NULL);
+
+	/*
+	 * What do we do with status here?
+	 * g_return_if_fail(status != NULL);
+	 */
+
+	gaim_debug_info("gtkblist", "Updating buddy list\n");
+	gaim_gtk_blist_update(gaim_get_blist(), (GaimBlistNode*)buddy);	
+}
+
 static GaimBlistUiOps blist_ui_ops =
 {
 	gaim_gtk_blist_new_list,
@@ -4610,7 +4625,8 @@
 	gaim_gtk_blist_set_visible,
 	gaim_gtk_blist_request_add_buddy,
 	gaim_gtk_blist_request_add_chat,
-	gaim_gtk_blist_request_add_group
+	gaim_gtk_blist_request_add_group,
+	gaim_gtk_blist_status_changed
 };