comparison src/idle.c @ 12573:200f22ca4890

[gaim-migrate @ 14895] Bring back 'Gaim idle' This seems to be working for me committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 20 Dec 2005 06:41:56 +0000
parents a88ca6da0b38
children bd80fb1e8406
comparison
equal deleted inserted replaced
12572:bf01b160ab0d 12573:200f22ca4890
174 static gint 174 static gint
175 check_idleness() 175 check_idleness()
176 { 176 {
177 time_t time_idle; 177 time_t time_idle;
178 gboolean auto_away; 178 gboolean auto_away;
179 const gchar *idle_reporting;
179 gboolean report_idle; 180 gboolean report_idle;
180 GList *l; 181 GList *l;
181 182
182 gaim_signal_emit(gaim_blist_get_handle(), "update-idle"); 183 gaim_signal_emit(gaim_blist_get_handle(), "update-idle");
183 184
184 if (idle_ui_ops != NULL && idle_ui_ops->get_time_idle != NULL) 185 idle_reporting = gaim_prefs_get_string("/core/away/idle_reporting");
186 report_idle = TRUE;
187 if (!strcmp(idle_reporting, "system") &&
188 (idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL))
189 {
190 /* Use system idle time (mouse or keyboard movement, etc.) */
185 time_idle = idle_ui_ops->get_time_idle(); 191 time_idle = idle_ui_ops->get_time_idle();
186 else 192 }
193 else if (!strcmp(idle_reporting, "gaim"))
194 {
187 /* Use 'Gaim idle' */ 195 /* Use 'Gaim idle' */
188 time_idle = time(NULL) - last_active_time; 196 time_idle = time(NULL) - last_active_time;
197 }
198 else
199 {
200 /* Don't report idle time */
201 time_idle = 0;
202 report_idle = FALSE;
203 }
189 204
190 /* Auto-away stuff */ 205 /* Auto-away stuff */
191 auto_away = gaim_prefs_get_bool("/core/away/away_when_idle"); 206 auto_away = gaim_prefs_get_bool("/core/away/away_when_idle");
192 if (auto_away && 207 if (auto_away &&
193 (time_idle > (60 * gaim_prefs_get_int("/core/away/mins_before_away")))) 208 (time_idle > (60 * gaim_prefs_get_int("/core/away/mins_before_away"))))
200 for (l = gaim_connections_get_all(); l != NULL; l = l->next) 215 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
201 unset_account_autoaway(l->data); 216 unset_account_autoaway(l->data);
202 } 217 }
203 218
204 /* Idle reporting stuff */ 219 /* Idle reporting stuff */
205 report_idle = gaim_prefs_get_bool("/core/away/report_idle");
206 if (report_idle && (time_idle >= IDLEMARK) && !have_set_idle) 220 if (report_idle && (time_idle >= IDLEMARK) && !have_set_idle)
207 { 221 {
208 for (l = gaim_connections_get_all(); l != NULL; l = l->next) 222 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
209 set_account_idle(l->data, time_idle); 223 set_account_idle(l->data, time_idle);
210 have_set_idle = TRUE; 224 have_set_idle = TRUE;