src/idle.c

changeset 11677
89c2ab8d2ebf
parent 11654
3f025590a95a
child 11697
f7ee74b6caf9
equal deleted inserted replaced
11676:9589185e4997 11677:89c2ab8d2ebf
33 # endif 33 # endif
34 #endif /* USE_SCREENSAVER */ 34 #endif /* USE_SCREENSAVER */
35 35
36 #include "connection.h" 36 #include "connection.h"
37 #include "debug.h" 37 #include "debug.h"
38 #include "gtkstatusbox.h"
38 #include "log.h" 39 #include "log.h"
39 #include "prefs.h" 40 #include "prefs.h"
41 #include "savedstatuses.h"
40 #include "signals.h" 42 #include "signals.h"
41 43
42 #define IDLEMARK 600 /* 10 minutes! */ 44 #define IDLEMARK 600 /* 10 minutes! */
43 45
44 typedef enum 46 typedef enum
45 { 47 {
46 GAIM_IDLE_NOT_AWAY = 0, 48 GAIM_IDLE_NOT_AWAY = 0,
47 GAIM_IDLE_AUTO_AWAY, 49 GAIM_IDLE_AUTO_AWAY,
108 * 1. Get your idle time. It will query XScreenSaver or Windows 110 * 1. Get your idle time. It will query XScreenSaver or Windows
109 * or get the Gaim idle time. Whatever. 111 * or get the Gaim idle time. Whatever.
110 * 2. Set or unset your auto-away message. 112 * 2. Set or unset your auto-away message.
111 * 3. Report your current idle time to the IM server. 113 * 3. Report your current idle time to the IM server.
112 */ 114 */
115 /* TODO: This needs to be namespaced or moved elsewhere. */
113 gint 116 gint
114 check_idle(gpointer data) 117 check_idle(gpointer data)
115 { 118 {
116 GaimConnection *gc = data; 119 GaimConnection *gc = data;
117 gboolean report_idle; 120 gboolean report_idle;
146 presence = gaim_account_get_presence(account); 149 presence = gaim_account_get_presence(account);
147 150
148 if (gaim_presence_is_available(presence)) 151 if (gaim_presence_is_available(presence))
149 { 152 {
150 const char *idleaway_name; 153 const char *idleaway_name;
154 GaimSavedStatus *saved_status;
151 155
152 gaim_debug_info("idle", "Making %s auto-away\n", 156 gaim_debug_info("idle", "Making %s auto-away\n",
153 gaim_account_get_username(account)); 157 gaim_account_get_username(account));
154 158
155 /* TODO XXX STATUS AWAY CORE/UI */ 159 /* TODO XXX STATUS AWAY CORE/UI */
156 /* Mark our accounts "away" using the idleaway status */ 160 /* Mark our accounts "away" using the idleaway status */
157 idleaway_name = gaim_prefs_get_string("/core/status/idleaway"); 161 idleaway_name = gaim_prefs_get_string("/core/status/idleaway");
162 saved_status = gaim_savedstatus_find(idleaway_name);
163 gtk_gaim_status_box_activate_saved_status(saved_status);
158 164
159 gc->is_auto_away = GAIM_IDLE_AUTO_AWAY; 165 gc->is_auto_away = GAIM_IDLE_AUTO_AWAY;
160 } else { 166 } else {
161 gc->is_auto_away = GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY; 167 gc->is_auto_away = GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY;
162 } 168 }

mercurial