comparison src/idle.c @ 1404:96e93119268d

[gaim-migrate @ 1414] argh committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 13 Jan 2001 08:49:15 +0000
parents bf041349b11e
children 9f356885a77a
comparison
equal deleted inserted replaced
1403:c0aa7fdc0a93 1404:96e93119268d
35 #include "multi.h" 35 #include "multi.h"
36 #include "gaim.h" 36 #include "gaim.h"
37 #include "prpl.h" 37 #include "prpl.h"
38 38
39 39
40 int auto_is_away = 0;
41
42
43 gint check_idle(struct gaim_connection *gc) 40 gint check_idle(struct gaim_connection *gc)
44 { 41 {
45 time_t t; 42 time_t t;
46 #ifdef USE_SCREENSAVER 43 #ifdef USE_SCREENSAVER
47 static XScreenSaverInfo *mit_info = NULL; 44 static XScreenSaverInfo *mit_info = NULL;
68 idle_time = (mit_info->idle) / 1000; 65 idle_time = (mit_info->idle) / 1000;
69 } else 66 } else
70 #endif /* USE_SCREENSAVER */ 67 #endif /* USE_SCREENSAVER */
71 idle_time = t - gc->lastsent; 68 idle_time = t - gc->lastsent;
72 69
73 if ((general_options & OPT_GEN_AUTO_AWAY) && 70 if ((general_options & OPT_GEN_AUTO_AWAY) && (idle_time > (60 * auto_away)) &&
74 (idle_time > (60 * auto_away)) && (awaymessage == NULL) && (auto_is_away == 0)) { 71 (!gc->away) && (!gc->is_auto_away)) {
75 set_default_away((GtkWidget*)NULL, 72 set_default_away((GtkWidget*)NULL, (gpointer)g_slist_index(away_messages, default_away));
76 (gpointer)g_slist_index(away_messages,
77 default_away));
78 serv_set_away(gc, GAIM_AWAY_CUSTOM, default_away->message); 73 serv_set_away(gc, GAIM_AWAY_CUSTOM, default_away->message);
79 auto_is_away = 1; 74 gc->is_auto_away = TRUE;
80 } else if (auto_is_away == 1 && idle_time < 60 * auto_away) { 75 } else if (gc->is_auto_away && idle_time < 60 * auto_away) {
81 auto_is_away = 0; 76 gc->is_auto_away = FALSE;
82 if (awaymessage != NULL) 77 if (awaymessage != NULL)
83 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); 78 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
84 } 79 }
85 80
86 81