changeset 9237:fac583b4ecdf

[gaim-migrate @ 10035] Make sure that the buddy we're emitting buddy-idle-changed for is indeed online and idle. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 08 Jun 2004 02:20:14 +0000
parents e8d86fd68552
children f4f210e47b60
files src/server.c
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/server.c	Tue Jun 08 02:12:40 2004 +0000
+++ b/src/server.c	Tue Jun 08 02:20:14 2004 +0000
@@ -1075,12 +1075,23 @@
 static gboolean
 idle_timeout_cb(void)
 {
-	GList *l;
+	GList *l, *l_next;
+
+	for (l = idle_buddies; l != NULL; l = l_next)
+	{
+		GaimBuddy *buddy = (GaimBuddy *)l->data;
+
+		l_next = l->next;
 
-	for (l = idle_buddies; l != NULL; l = l->next)
-	{
-		gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle-updated",
-						 l->data);
+		if (!GAIM_BUDDY_IS_ONLINE(buddy) || buddy->idle <= 0)
+		{
+			remove_idle_buddy(buddy);
+		}
+		else
+		{
+			gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle-updated",
+							 l->data);
+		}
 	}
 
 	return TRUE;