# HG changeset patch # User Christian Hammond # Date 1086660145 0 # Node ID f18eb3f22733bc35fa0e5f17bdb03ca03c9e21b7 # Parent 0c352d0e4ddce04c8a9780d5b41c3b66a4cabb12 [gaim-migrate @ 10030] This appears to be somewhat hacky, but due to the lack of a timer in blist.c, we need a core place to emit buddy-idle-updated. server.c now maintains a list of idle buddies and emits the signal when appropriate. We really need a better way to do this, which I'll attempt to incorporate into the status rewrite, but perhaps the best way would involve the blist update timer being in blist.c. Anyhow, this works for now. committer: Tailor Script diff -r 0c352d0e4ddc -r f18eb3f22733 src/gtkblist.c --- a/src/gtkblist.c Mon Jun 07 10:09:29 2004 +0000 +++ b/src/gtkblist.c Tue Jun 08 02:02:25 2004 +0000 @@ -3541,8 +3541,6 @@ idle = g_strdup_printf("(%d:%02d)", ihrs, imin); else idle = g_strdup_printf("(%d)", imin); - - gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle-updated", buddy); } if (buddy->evil > 0) diff -r 0c352d0e4ddc -r f18eb3f22733 src/server.c --- a/src/server.c Mon Jun 07 10:09:29 2004 +0000 +++ b/src/server.c Tue Jun 08 02:02:25 2004 +0000 @@ -1055,7 +1055,27 @@ g_free(message); } +/* + * NOTE: This is a bit hacky, but needed for core support for the + * buddy-idle-updated signal. It's temporary, and will be replaced + * with better code in the status rewrite. + */ +static GList *idle_buddies = NULL; +static guint idle_buddy_timeout_id = 0; +static gboolean +idle_timeout_cb(void) +{ + GList *l; + + for (l = idle_buddies; l != NULL; l = l->next) + { + gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle-updated", + l->data); + } + + return TRUE; +} void serv_got_update(GaimConnection *gc, const char *name, int loggedin, int evil, time_t signon, time_t idle, int type) @@ -1219,14 +1239,26 @@ if (!old_idle && idle) { gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle", b); + + idle_buddies = g_list_append(idle_buddies, b); + + if (idle_buddy_timeout_id == 0) + { + idle_buddy_timeout_id = gaim_timeout_add(10000, + (GSourceFunc)idle_timeout_cb, NULL); + } } else if (old_idle && !idle) { gaim_signal_emit(gaim_blist_get_handle(), "buddy-unidle", b); - } - else if (old_idle != idle) - { - gaim_signal_emit(gaim_blist_get_handle(), "buddy-idle-updated", b); + + idle_buddies = g_list_remove(idle_buddies, b); + + if (idle_buddies == NULL) + { + gaim_timeout_remove(idle_buddy_timeout_id); + idle_buddy_timeout_id = 0; + } } if (c != NULL)