comparison src/idle.c @ 1029:740c6f933fe0

[gaim-migrate @ 1039] So here's why this needed to be fixed: There is a boolean value (stored as int....), is_idle, in each gc. It's used to indicate whether we've told the server that we're idle. You only need to tell the server once. Before this patch, there were two scenarios: X use and Gaim use. If you had idle set to X use, then you were telling the server every 20 seconds how idle you were. If you had idle set to gaim use, then you were never idle, because you would be updating when your last unidle action was every 20 seconds. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 26 Oct 2000 18:05:29 +0000
parents e4147c8604cc
children 38452403563b
comparison
equal deleted inserted replaced
1028:e4147c8604cc 1029:740c6f933fe0
45 static Display *d = NULL; 45 static Display *d = NULL;
46 time_t idle_time; 46 time_t idle_time;
47 #endif 47 #endif
48 48
49 /* Not idle, really... :) */ 49 /* Not idle, really... :) */
50 update_all_buddies(); 50 update_all_buddies();
51 51
52 plugin_event(event_blist_update, 0, 0, 0, 0); 52 plugin_event(event_blist_update, 0, 0, 0, 0);
53 53
54 time(&t); 54 time(&t);
55 55
56 if (report_idle == 0) 56 if (report_idle == 0)
57 return TRUE; 57 return TRUE;
58 /*
59 if (gc->is_idle) {
60 fprintf (stderr, "\tgc->is_idle\n");
61 return TRUE;
62 }
63 */
64 58
65 #ifdef USE_SCREENSAVER 59 #ifdef USE_SCREENSAVER
66 if (report_idle == IDLE_SCREENSAVER) { 60 if (report_idle == IDLE_SCREENSAVER) {
67 if (!d) 61 if (!d)
68 d = XOpenDisplay((char *)NULL); 62 d = XOpenDisplay((char *)NULL);
73 idle_time = (mit_info->idle)/1000; 67 idle_time = (mit_info->idle)/1000;
74 } else 68 } else
75 #endif /* USE_SCREENSAVER */ 69 #endif /* USE_SCREENSAVER */
76 idle_time = t - gc->lastsent; 70 idle_time = t - gc->lastsent;
77 71
78 if (idle_time > 600) { /* 10 minutes! */ 72 if (idle_time > 600 && !gc->is_idle) { /* 10 minutes! */
73 debug_printf("setting %s idle %d seconds\n", gc->username, idle_time);
79 serv_set_idle(gc, idle_time); 74 serv_set_idle(gc, idle_time);
80 gc->is_idle = 1; 75 gc->is_idle = 1;
81 } else 76 } else if (idle_time < 600 && gc->is_idle) {
77 debug_printf("setting %s unidle\n", gc->username);
82 serv_touch_idle(gc); 78 serv_touch_idle(gc);
79 }
83 80
84 return TRUE; 81 return TRUE;
85 82
86 } 83 }