Mercurial > pidgin.yaz
diff src/idle.c @ 1109:c73736fa0b7c
[gaim-migrate @ 1119]
Auto-Away, courtesy BMiller. damn cool. i'm impressed. also minor touch-ups, mostly to indicate what all the FIXME's mean.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 20 Nov 2000 10:37:40 +0000 |
parents | 9446ac58745e |
children | 8f4ce8b74901 |
line wrap: on
line diff
--- a/src/idle.c Mon Nov 20 08:35:25 2000 +0000 +++ b/src/idle.c Mon Nov 20 10:37:40 2000 +0000 @@ -36,6 +36,9 @@ #include "gaim.h" +int auto_is_away = 0; + + gint check_idle(struct gaim_connection *gc) { time_t t; @@ -52,8 +55,6 @@ time(&t); - if (report_idle == 0) - return TRUE; #ifdef USE_SCREENSAVER if (report_idle == IDLE_SCREENSAVER) { @@ -68,6 +69,31 @@ #endif /* USE_SCREENSAVER */ idle_time = t - gc->lastsent; + if ((general_options & OPT_GEN_AUTO_AWAY) && + (idle_time > (60 * auto_away)) && + (awaymessage == NULL) && + (auto_is_away == 0)) { + struct away_message *a; + set_default_away((GtkWidget*)NULL, (gpointer)default_away); + a = g_slist_nth_data(away_messages, default_away); + do_away_message((GtkWidget*)NULL, a); + auto_is_away = 1; + } else if (auto_is_away == 1 && awaymessage != NULL && + idle_time < 60*auto_away) { + do_im_back((GtkWidget*)NULL, (GtkWidget*)NULL); + auto_is_away = 0; + } + if (auto_is_away == 1 && awaymessage == NULL) + auto_is_away = 0; + + + /* If we're not reporting idle times to the server, still use Gaim + usage for auto-away, but quit here so we don't report to the + server */ + if (report_idle == 0) { + return TRUE; + } + if (idle_time > 600 && !gc->is_idle) { /* 10 minutes! */ debug_printf("setting %s idle %d seconds\n", gc->username, idle_time); serv_set_idle(gc, idle_time);