annotate src/idle.c @ 9958:de25b23933fa

[gaim-migrate @ 10864] (21:02:12) Me: think you can find time and interest to get the docklet functional? (21:02:26) Me: if you think it unlikely tell me and i'll find someone else (21:04:01) Robot101: I already updated HEAD (21:22:57) Robot101: there we go, compiles committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 07 Sep 2004 01:40:50 +0000
parents ced29c7b396c
children bdec08a8fc5b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
1 /*
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
2 * gaim
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
3 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7475
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7475
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7475
diff changeset
6 * source distribution.
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 *
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
8 * This program is free software; you can redistribute it and/or modify
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
9 * it under the terms of the GNU General Public License as published by
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
11 * (at your option) any later version.
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 *
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
13 * This program is distributed in the hope that it will be useful,
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
16 * GNU General Public License for more details.
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 *
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
18 * You should have received a copy of the GNU General Public License
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
19 * along with this program; if not, write to the Free Software
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 */
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9730
diff changeset
23 #include "internal.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
25 #ifdef USE_SCREENSAVER
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
26 # ifndef _WIN32
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
27 # include <X11/Xlib.h>
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
28 # include <X11/Xutil.h>
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
29 # include <X11/extensions/scrnsaver.h>
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
30 # include <gdk/gdkx.h>
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
31 # else
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
32 # include "idletrack.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
33 # endif
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
34 #endif /* USE_SCREENSAVER */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35
5615
6500a6c8d679 [gaim-migrate @ 6022]
Christian Hammond <chipx86@chipx86.com>
parents: 5563
diff changeset
36 #include "connection.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
37 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
38 #include "log.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
39 #include "prefs.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
40 #include "signals.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
41
9709
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 9693
diff changeset
42 /* XXX - Get this out of here! */
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
43 #include "away.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
44
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
45 /* XXX For the away stuff */
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5755
diff changeset
46 #include "gaim.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47
4536
ba99d30afc14 [gaim-migrate @ 4815]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4201
diff changeset
48 #define IDLEMARK 600 /* 10 minutes! */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49
2381
427ccd7dfdd2 [gaim-migrate @ 2394]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
50 gint check_idle(gpointer data)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
51 {
5560
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5548
diff changeset
52 const char *report_idle;
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
53 GaimConnection *gc = data;
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
54 GaimAccount *account;
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
55 time_t t;
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
56 #ifdef USE_SCREENSAVER
3905
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3517
diff changeset
57 #ifndef _WIN32
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
58 static XScreenSaverInfo *mit_info = NULL;
1062
9446ac58745e [gaim-migrate @ 1072]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1058
diff changeset
59 #endif
3905
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3517
diff changeset
60 #endif
4201
511c2b63caa4 [gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents: 3905
diff changeset
61 int idle_time;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
62
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
63 account = gaim_connection_get_account(gc);
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
64
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
65 gaim_signal_emit(gaim_blist_get_handle(), "update-idle");
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1141
diff changeset
66
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
67 time(&t);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68
5560
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5548
diff changeset
69 report_idle = gaim_prefs_get_string("/gaim/gtk/idle/reporting_method");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
71 #ifdef USE_SCREENSAVER
5755
9587ee01dc5d [gaim-migrate @ 6180]
Christian Hammond <chipx86@chipx86.com>
parents: 5748
diff changeset
72 if (report_idle != NULL && !strcmp(report_idle, "system")) {
3905
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3517
diff changeset
73 #ifndef _WIN32
2115
3ce77b547cf2 [gaim-migrate @ 2125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2114
diff changeset
74 int event_base, error_base;
3ce77b547cf2 [gaim-migrate @ 2125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2114
diff changeset
75 if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) {
2114
c582116e8463 [gaim-migrate @ 2124]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
76 if (mit_info == NULL) {
c582116e8463 [gaim-migrate @ 2124]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
77 mit_info = XScreenSaverAllocInfo();
c582116e8463 [gaim-migrate @ 2124]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
78 }
2115
3ce77b547cf2 [gaim-migrate @ 2125]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2114
diff changeset
79 XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info);
2114
c582116e8463 [gaim-migrate @ 2124]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
80 idle_time = (mit_info->idle) / 1000;
c582116e8463 [gaim-migrate @ 2124]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
81 } else
c582116e8463 [gaim-migrate @ 2124]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
82 idle_time = 0;
3905
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3517
diff changeset
83 #else
4536
ba99d30afc14 [gaim-migrate @ 4815]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4201
diff changeset
84 idle_time = (GetTickCount() - wgaim_get_lastactive()) / 1000;
3905
3e508dd31b76 [gaim-migrate @ 4058]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3517
diff changeset
85 #endif
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
86 } else
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
87 #endif /* USE_SCREENSAVER */
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
88 idle_time = t - gc->last_sent_time;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
89
5560
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5548
diff changeset
90 if (gaim_prefs_get_bool("/core/away/away_when_idle") &&
5748
c6a30e1868ae [gaim-migrate @ 6173]
Nathan Walp <nwalp@pidgin.im>
parents: 5615
diff changeset
91 (idle_time > (60 * gaim_prefs_get_int("/core/away/mins_before_away")))
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
92 && (!gc->is_auto_away))
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
93 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
94 GaimPresence *presence;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
95
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
96 presence = gaim_account_get_presence(account);
5560
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5548
diff changeset
97
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
98 if (gaim_presence_is_available(presence))
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
99 {
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
100 /* XXX CORE/UI
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
101 struct away_message *default_away = NULL;
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
102 GSList *l;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
103 */
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
104 const char *default_name;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
105
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
106 default_name = gaim_prefs_get_string("/core/away/default_message");
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
107 /* XXX CORE/UI
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
108 for(l = away_messages; l; l = l->next) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
109 if(!strcmp(default_name, ((struct away_message *)l->data)->name)) {
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
110 default_away = l->data;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
111 break;
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
112 }
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
113 }
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
114
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
115 if(!default_away && away_messages)
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
116 default_away = away_messages->data;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
117 */
6216
dc42b27101c0 [gaim-migrate @ 6702]
Nathan Walp <nwalp@pidgin.im>
parents: 5872
diff changeset
118
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
119 gaim_debug(GAIM_DEBUG_INFO, "idle",
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
120 "Making %s away automatically\n",
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
121 gaim_account_get_username(account));
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
122
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
123 /* XXX CORE/UI
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
124 if (g_list_length(gaim_connections_get_all()) == 1)
1446
38f712e75836 [gaim-migrate @ 1456]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1407
diff changeset
125 do_away_message(NULL, default_away);
1895
e65b9942f649 [gaim-migrate @ 1905]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1885
diff changeset
126 else if (default_away)
1446
38f712e75836 [gaim-migrate @ 1456]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1407
diff changeset
127 serv_set_away(gc, GAIM_AWAY_CUSTOM, default_away->message);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
128 */
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
129
1468
9db35684c68c [gaim-migrate @ 1478]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1450
diff changeset
130 gc->is_auto_away = 1;
9db35684c68c [gaim-migrate @ 1478]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1450
diff changeset
131 } else
9db35684c68c [gaim-migrate @ 1478]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1450
diff changeset
132 gc->is_auto_away = 2;
5748
c6a30e1868ae [gaim-migrate @ 6173]
Nathan Walp <nwalp@pidgin.im>
parents: 5615
diff changeset
133 } else if (gc->is_auto_away &&
c6a30e1868ae [gaim-migrate @ 6173]
Nathan Walp <nwalp@pidgin.im>
parents: 5615
diff changeset
134 idle_time < 60 * gaim_prefs_get_int("/core/away/mins_before_away")) {
1468
9db35684c68c [gaim-migrate @ 1478]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1450
diff changeset
135 if (gc->is_auto_away == 2) {
9db35684c68c [gaim-migrate @ 1478]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1450
diff changeset
136 gc->is_auto_away = 0;
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
137 return TRUE;
1446
38f712e75836 [gaim-migrate @ 1456]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1407
diff changeset
138 }
1468
9db35684c68c [gaim-migrate @ 1478]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1450
diff changeset
139 gc->is_auto_away = 0;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
140
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
141 /* XXX CORE/UI
1407
9f356885a77a [gaim-migrate @ 1417]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
142 if (awaymessage == NULL) {
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
143 gaim_debug(GAIM_DEBUG_INFO, "idle",
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
144 "Removing auto-away message for %s\n", gaim_account_get_username(account));
1401
bf041349b11e [gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1367
diff changeset
145 serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL);
1407
9f356885a77a [gaim-migrate @ 1417]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
146 } else {
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
147 if (g_list_length(gaim_connections_get_all()) == 1)
1450
024f9250ba63 [gaim-migrate @ 1460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1446
diff changeset
148 do_im_back(0, 0);
024f9250ba63 [gaim-migrate @ 1460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1446
diff changeset
149 else {
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
150 gaim_debug(GAIM_DEBUG_INFO, "idle",
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
151 "Replacing auto-away with global for %s\n",
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
152 gaim_account_get_username(account));
1450
024f9250ba63 [gaim-migrate @ 1460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1446
diff changeset
153 serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message);
024f9250ba63 [gaim-migrate @ 1460]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1446
diff changeset
154 }
1407
9f356885a77a [gaim-migrate @ 1417]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1404
diff changeset
155 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9791
diff changeset
156 */
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
157 }
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
158
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
159
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
160 /* If we're not reporting idle times to the server, still use Gaim
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
161 usage for auto-away, but quit here so we don't report to the
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
162 server */
5560
b7319c094153 [gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents: 5548
diff changeset
163
5755
9587ee01dc5d [gaim-migrate @ 6180]
Christian Hammond <chipx86@chipx86.com>
parents: 5748
diff changeset
164 if (report_idle != NULL && !strcmp(report_idle, "none"))
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
165 return TRUE;
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1062
diff changeset
166
4547
1f19b66c5d84 [gaim-migrate @ 4826]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4536
diff changeset
167 if (idle_time >= IDLEMARK && !gc->is_idle) {
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
168 gaim_debug(GAIM_DEBUG_INFO, "idle", "Setting %s idle %d seconds\n",
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
169 gaim_account_get_username(account), idle_time);
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
170 serv_set_idle(gc, idle_time);
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
171 gc->is_idle = 1;
7475
08ce2a94d9c7 [gaim-migrate @ 8088]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
172 /* LOG system_log(log_idle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); */
4536
ba99d30afc14 [gaim-migrate @ 4815]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4201
diff changeset
173 } else if (idle_time < IDLEMARK && gc->is_idle) {
5211
0241d6b6702d [gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
174 gaim_debug(GAIM_DEBUG_INFO, "idle", "Setting %s unidle\n",
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
175 gaim_account_get_username(account));
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
176 serv_touch_idle(gc);
7475
08ce2a94d9c7 [gaim-migrate @ 8088]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
177 /* LOG system_log(log_unidle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); */
1029
740c6f933fe0 [gaim-migrate @ 1039]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1028
diff changeset
178 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
179
1026
5bad25457843 [gaim-migrate @ 1036]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
180 return TRUE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
181
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
182 }