comparison src/idle.c @ 1250:b5783215b245

[gaim-migrate @ 1260] decklin's clean up of the account editor, much needed. indent -kr -i8 -l105 -ncs -cp7 -npcs -T GtkWidget -T gpointer -T AppletCallbackFunc -T GtkFunction -T gaim_plugin_remove -T name -T FILE -T gchar -T user_opts -T GdkEvent -T GtkObject ... did about.c, aim.c, away.c, browser.c, buddy_chat.c, gaimrc.c, html.c, idle.c, multi.c. Need to do buddy.c, conversation.c, dialogs.c, oscar.c, perl.c, plugins.c, prefs.c, proxy.c, prpl.c, rvous.c, server.c, sound.c, toc.c, util.c. not doing gtkhtml.c because it's a piece of crap anyway, or *ticker.c because they're syd's. got rid of debug_buff, just debug_printf now. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 13 Dec 2000 20:18:35 +0000
parents 8f4ce8b74901
children 9da444224f0e
comparison
equal deleted inserted replaced
1249:3e44de27622d 1250:b5783215b245
46 static XScreenSaverInfo *mit_info = NULL; 46 static XScreenSaverInfo *mit_info = NULL;
47 static Display *d = NULL; 47 static Display *d = NULL;
48 #endif 48 #endif
49 time_t idle_time; 49 time_t idle_time;
50 50
51 /* Not idle, really... :) */ 51 /* Not idle, really... :) */
52 update_idle_times(); 52 update_idle_times();
53 53
54 plugin_event(event_blist_update, 0, 0, 0, 0); 54 plugin_event(event_blist_update, 0, 0, 0, 0);
55 55
56 time(&t); 56 time(&t);
57 57
58 58
59 #ifdef USE_SCREENSAVER 59 #ifdef USE_SCREENSAVER
60 if (report_idle == IDLE_SCREENSAVER) { 60 if (report_idle == IDLE_SCREENSAVER) {
61 if (!d) 61 if (!d)
62 d = XOpenDisplay((char *)NULL); 62 d = XOpenDisplay((char *)NULL);
63 if (mit_info == NULL) { 63 if (mit_info == NULL) {
64 mit_info = XScreenSaverAllocInfo (); 64 mit_info = XScreenSaverAllocInfo();
65 } 65 }
66 XScreenSaverQueryInfo (d, DefaultRootWindow(d), mit_info); 66 XScreenSaverQueryInfo(d, DefaultRootWindow(d), mit_info);
67 idle_time = (mit_info->idle)/1000; 67 idle_time = (mit_info->idle) / 1000;
68 } else 68 } else
69 #endif /* USE_SCREENSAVER */ 69 #endif /* USE_SCREENSAVER */
70 idle_time = t - gc->lastsent; 70 idle_time = t - gc->lastsent;
71 71
72 if ((general_options & OPT_GEN_AUTO_AWAY) && 72 if ((general_options & OPT_GEN_AUTO_AWAY) &&
73 (idle_time > (60 * auto_away)) && 73 (idle_time > (60 * auto_away)) && (awaymessage == NULL) && (auto_is_away == 0)) {
74 (awaymessage == NULL) &&
75 (auto_is_away == 0)) {
76 struct away_message *a; 74 struct away_message *a;
77 set_default_away((GtkWidget*)NULL, (gpointer)default_away); 75 set_default_away((GtkWidget *)NULL, (gpointer)default_away);
78 a = g_slist_nth_data(away_messages, default_away); 76 a = g_slist_nth_data(away_messages, default_away);
79 do_away_message((GtkWidget*)NULL, a); 77 do_away_message((GtkWidget *)NULL, a);
80 auto_is_away = 1; 78 auto_is_away = 1;
81 } else if (auto_is_away == 1 && idle_time < 60*auto_away) { 79 } else if (auto_is_away == 1 && idle_time < 60 * auto_away) {
82 auto_is_away = 0; 80 auto_is_away = 0;
83 if (awaymessage != NULL) 81 if (awaymessage != NULL)
84 do_im_back((GtkWidget*)NULL, (GtkWidget*)NULL); 82 do_im_back((GtkWidget *)NULL, (GtkWidget *)NULL);
85 } 83 }
86 84
87 85
88 /* If we're not reporting idle times to the server, still use Gaim 86 /* If we're not reporting idle times to the server, still use Gaim
89 usage for auto-away, but quit here so we don't report to the 87 usage for auto-away, but quit here so we don't report to the
90 server */ 88 server */
91 if (report_idle == 0) { 89 if (report_idle == 0) {
92 return TRUE; 90 return TRUE;
93 } 91 }
94 92
95 if (idle_time > 600 && !gc->is_idle) { /* 10 minutes! */ 93 if (idle_time > 600 && !gc->is_idle) { /* 10 minutes! */
96 debug_printf("setting %s idle %d seconds\n", gc->username, idle_time); 94 debug_printf("setting %s idle %d seconds\n", gc->username, idle_time);
97 serv_set_idle(gc, idle_time); 95 serv_set_idle(gc, idle_time);
98 gc->is_idle = 1; 96 gc->is_idle = 1;
99 } else if (idle_time < 600 && gc->is_idle) { 97 } else if (idle_time < 600 && gc->is_idle) {
100 debug_printf("setting %s unidle\n", gc->username); 98 debug_printf("setting %s unidle\n", gc->username);
101 serv_touch_idle(gc); 99 serv_touch_idle(gc);
102 } 100 }
103 101
104 return TRUE; 102 return TRUE;