comparison src/idle.c @ 4536:ba99d30afc14

[gaim-migrate @ 4815] New idletracker committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Wed, 05 Feb 2003 23:50:05 +0000
parents 511c2b63caa4
children 1f19b66c5d84
comparison
equal deleted inserted replaced
4535:de9f45c815df 4536:ba99d30afc14
31 #include <X11/Xlib.h> 31 #include <X11/Xlib.h>
32 #include <X11/Xutil.h> 32 #include <X11/Xutil.h>
33 #include <X11/extensions/scrnsaver.h> 33 #include <X11/extensions/scrnsaver.h>
34 #include <gdk/gdkx.h> 34 #include <gdk/gdkx.h>
35 #else 35 #else
36 #include "IdleTracker.h" 36 #include "idletrack.h"
37 #endif 37 #endif
38 #endif /* USE_SCREENSAVER */ 38 #endif /* USE_SCREENSAVER */
39 39
40 #include "multi.h" 40 #include "multi.h"
41 #include "gaim.h" 41 #include "gaim.h"
42 #include "prpl.h" 42 #include "prpl.h"
43 43
44 #define IDLEMARK 600 /* 10 minutes! */
44 45
45 gint check_idle(gpointer data) 46 gint check_idle(gpointer data)
46 { 47 {
47 struct gaim_connection *gc = data; 48 struct gaim_connection *gc = data;
48 time_t t; 49 time_t t;
72 XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info); 73 XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info);
73 idle_time = (mit_info->idle) / 1000; 74 idle_time = (mit_info->idle) / 1000;
74 } else 75 } else
75 idle_time = 0; 76 idle_time = 0;
76 #else 77 #else
77 /* IdleTracker monitors usage of all other apps by setting a hook function */ 78 idle_time = (GetTickCount() - wgaim_get_lastactive()) / 1000;
78 idle_time = (GetTickCount() - IdleTrackerGetLastTickCount()) / 1000;
79 #endif 79 #endif
80 } else 80 } else
81 #endif /* USE_SCREENSAVER */ 81 #endif /* USE_SCREENSAVER */
82 idle_time = t - gc->lastsent; 82 idle_time = t - gc->lastsent;
83 83
117 server */ 117 server */
118 if (report_idle == IDLE_NONE) { 118 if (report_idle == IDLE_NONE) {
119 return TRUE; 119 return TRUE;
120 } 120 }
121 121
122 if (idle_time > 600 && !gc->is_idle) { /* 10 minutes! */ 122 if (idle_time > IDLEMARK && !gc->is_idle) {
123 debug_printf("setting %s idle %d seconds\n", gc->username, idle_time); 123 debug_printf("setting %s idle %d seconds\n", gc->username, idle_time);
124 serv_set_idle(gc, idle_time); 124 serv_set_idle(gc, idle_time);
125 gc->is_idle = 1; 125 gc->is_idle = 1;
126 system_log(log_idle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); 126 system_log(log_idle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON);
127 } else if (idle_time < 600 && gc->is_idle) { 127 } else if (idle_time < IDLEMARK && gc->is_idle) {
128 debug_printf("setting %s unidle\n", gc->username); 128 debug_printf("setting %s unidle\n", gc->username);
129 serv_touch_idle(gc); 129 serv_touch_idle(gc);
130 system_log(log_unidle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); 130 system_log(log_unidle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON);
131 } 131 }
132 132