annotate src/idle.c @ 13143:a1d5f154585b

[gaim-migrate @ 15506] SF Patch #1415729 from Evan "I've received a few crash reports in which yahoo_receivefile_connected() crashes in g_strdup_printf() as a result of being passed a NULL string. There are only two arguments to that call... xd->path and xd->host. If either were null for some reason, we couldn't receive a file, anyways, since we need both to do the HTTP GET request. This patch checks against NULL for both and cancels the transfer in the same manner it would be canceled if fed a negative (invalid) source." committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 07 Feb 2006 01:43:27 +0000
parents bd80fb1e8406
children b76c6de0c3b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * gaim
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * source distribution.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * (at your option) any later version.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * GNU General Public License for more details.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 #include "internal.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 #include "connection.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 #include "debug.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 #include "idle.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 #include "log.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 #include "prefs.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 #include "savedstatuses.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 #include "signals.h"
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 #define IDLEMARK 600 /* 10 minutes! */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 #define IDLE_CHECK_INTERVAL 5 /* 5 seconds */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 typedef enum
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 GAIM_IDLE_NOT_AWAY = 0,
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 GAIM_IDLE_AUTO_AWAY,
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 } GaimAutoAwayState;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 static GaimIdleUiOps *idle_ui_ops = NULL;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 /**
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47 * This is needed for the I'dle Mak'er plugin to work correctly. We
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
48 * use it to determine if we're the ones who set our accounts idle
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
49 * or if someone else did it (the I'dle Mak'er plugin, for example).
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
50 * Basically we just keep track of which accounts were set idle by us,
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
51 * and then we'll only set these specific accounts unidle when the
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
52 * user returns.
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
53 */
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
54 static GList *idled_accts = NULL;
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
55
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
56 static guint idle_timer = 0;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
57
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
58 static time_t last_active_time = 0;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
59
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
60 static void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
61 set_account_autoaway(GaimConnection *gc)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
62 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
63 GaimAccount *account;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
64 GaimPresence *presence;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
65 GaimStatus *status;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
66
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
67 if (gc->is_auto_away)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
68 /* This account is already auto-away! */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
69 return;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
70
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
71 account = gaim_connection_get_account(gc);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
72 presence = gaim_account_get_presence(account);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
73 status = gaim_presence_get_active_status(presence);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
74
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
75 if (gaim_status_is_available(status))
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
76 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
77 GaimSavedStatus *saved_status;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
78
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
79 gaim_debug_info("idle", "Making %s auto-away\n",
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
80 gaim_account_get_username(account));
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
81
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
82 saved_status = gaim_savedstatus_get_idleaway();
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
83 gaim_savedstatus_activate_for_account(saved_status, account);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
84
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
85 gc->is_auto_away = GAIM_IDLE_AUTO_AWAY;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
86 } else {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
87 gc->is_auto_away = GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
88 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
89 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
90
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
91 static void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
92 unset_account_autoaway(GaimConnection *gc)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94 GaimAccount *account;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
95 GaimPresence *presence;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
96 GaimStatus *status;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
97 GaimSavedStatus *saved_status;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
98
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
99 account = gaim_connection_get_account(gc);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 presence = gaim_account_get_presence(account);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
101 status = gaim_presence_get_active_status(presence);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
103 if (!gc->is_auto_away)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
104 /* This account is already not auto-away! */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 return;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107 if (gc->is_auto_away == GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY) {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
108 gc->is_auto_away = GAIM_IDLE_NOT_AWAY;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109 } else {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
110 gc->is_auto_away = GAIM_IDLE_NOT_AWAY;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
111
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
112 gaim_debug_info("idle", "%s returning from auto-away\n",
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
113 gaim_account_get_username(account));
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
115 /* Return our account to its previous status */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116 saved_status = gaim_savedstatus_get_current();
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117 gaim_savedstatus_activate_for_account(saved_status, account);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
118 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
119 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121 static void
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
122 set_account_idle(GaimAccount *account, int time_idle)
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
123 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
124 GaimPresence *presence;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
125
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126 presence = gaim_account_get_presence(account);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
127
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
128 if (gaim_presence_is_idle(presence))
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129 /* This account is already idle! */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130 return;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
132 gaim_debug_info("idle", "Setting %s idle %d seconds\n",
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
133 gaim_account_get_username(account), time_idle);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
134 gaim_presence_set_idle(presence, TRUE, time(NULL) - time_idle);
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
135 idled_accts = g_list_prepend(idled_accts, account);
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
136 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
137
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
138 static void
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
139 set_account_unidle(GaimAccount *account)
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
140 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
141 GaimPresence *presence;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
142
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 presence = gaim_account_get_presence(account);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
144
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
145 idled_accts = g_list_remove(idled_accts, account);
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
146
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
147 if (!gaim_presence_is_idle(presence))
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
148 /* This account is already unidle! */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
149 return;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
150
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 gaim_debug_info("idle", "Setting %s unidle\n",
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152 gaim_account_get_username(account));
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
153 gaim_presence_set_idle(presence, FALSE, time(NULL));
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
154 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 /*
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157 * This function should be called when you think your idle state
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
158 * may have changed. Maybe you're over the 10-minute mark and
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
159 * Gaim should start reporting idle time to the server. Maybe
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160 * you've returned from being idle. Maybe your auto-away message
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
161 * should be set.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
162 *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
163 * There is no harm to calling this many many times, other than
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
164 * it will be kinda slow. This is called every 5 seconds by a
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
165 * timer set when Gaim starts. It is also called when
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
166 * you send an IM, a chat, etc.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
168 * This function has 3 sections.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 * 1. Get your idle time. It will query XScreenSaver or Windows
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
170 * or use the Gaim idle time. Whatever.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
171 * 2. Set or unset your auto-away message.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
172 * 3. Report your current idle time to the IM server.
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
173 */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
174 static gint
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
175 check_idleness()
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
176 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
177 time_t time_idle;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
178 gboolean auto_away;
12573
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
179 const gchar *idle_reporting;
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
180 gboolean report_idle;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
181 GList *l;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
182
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
183 gaim_signal_emit(gaim_blist_get_handle(), "update-idle");
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
184
12573
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
185 idle_reporting = gaim_prefs_get_string("/core/away/idle_reporting");
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
186 report_idle = TRUE;
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
187 if (!strcmp(idle_reporting, "system") &&
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
188 (idle_ui_ops != NULL) && (idle_ui_ops->get_time_idle != NULL))
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
189 {
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
190 /* Use system idle time (mouse or keyboard movement, etc.) */
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 time_idle = idle_ui_ops->get_time_idle();
12573
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
192 }
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
193 else if (!strcmp(idle_reporting, "gaim"))
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
194 {
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
195 /* Use 'Gaim idle' */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 time_idle = time(NULL) - last_active_time;
12573
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
197 }
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
198 else
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
199 {
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
200 /* Don't report idle time */
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
201 time_idle = 0;
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
202 report_idle = FALSE;
200f22ca4890 [gaim-migrate @ 14895]
Mark Doliner <mark@kingant.net>
parents: 12412
diff changeset
203 }
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
204
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205 /* Auto-away stuff */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
206 auto_away = gaim_prefs_get_bool("/core/away/away_when_idle");
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
207 if (auto_away &&
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
208 (time_idle > (60 * gaim_prefs_get_int("/core/away/mins_before_away"))))
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
209 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
210 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
211 set_account_autoaway(l->data);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
212 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
213 else if (time_idle < 60 * gaim_prefs_get_int("/core/away/mins_before_away"))
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
215 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
216 unset_account_autoaway(l->data);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
217 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
218
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
219 /* Idle reporting stuff */
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
220 if (report_idle && (time_idle >= IDLEMARK))
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
221 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
222 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
223 {
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
224 GaimConnection *gc = l->data;
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
225 set_account_idle(gaim_connection_get_account(gc), time_idle);
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
226 }
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
227 }
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
228 else if (!report_idle || (time_idle < IDLEMARK))
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
229 {
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
230 while (idled_accts != NULL)
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
231 set_account_unidle(idled_accts->data);
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
232 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
233
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
234 return TRUE;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
235 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
236
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
237 static void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
238 im_msg_sent_cb(GaimAccount *account, const char *receiver,
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
239 const char *message, void *data)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
240 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
241 /* Check our idle time after an IM is sent */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
242 check_idleness();
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
245 static void
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
246 signing_off_cb(GaimConnection *gc, void *data)
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
247 {
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
248 GaimAccount *account;
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
249
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
250 account = gaim_connection_get_account(gc);
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
251 idled_accts = g_list_remove(idled_accts, account);
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
252 }
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
253
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
254 void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
255 gaim_idle_touch()
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
256 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
257 time(&last_active_time);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
258 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
260 void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
261 gaim_idle_set(time_t time)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
262 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
263 last_active_time = time;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
264 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
265
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
266 void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
267 gaim_idle_set_ui_ops(GaimIdleUiOps *ops)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
268 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
269 idle_ui_ops = ops;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
270 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
271
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
272 GaimIdleUiOps *
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
273 gaim_idle_get_ui_ops(void)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
274 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
275 return idle_ui_ops;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
276 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
277
12412
a88ca6da0b38 [gaim-migrate @ 14719]
Richard Laager <rlaager@wiktel.com>
parents: 12272
diff changeset
278 static void *
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
279 gaim_idle_get_handle()
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
280 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
281 static int handle;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
282
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
283 return &handle;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
284 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
285
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
286 void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
287 gaim_idle_init()
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
288 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
289 /* Add the timer to check if we're idle */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
290 idle_timer = gaim_timeout_add(IDLE_CHECK_INTERVAL * 1000, check_idleness, NULL);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
291
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
292 gaim_signal_connect(gaim_conversations_get_handle(), "sent-im-msg",
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
293 gaim_idle_get_handle(),
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
294 GAIM_CALLBACK(im_msg_sent_cb), NULL);
12825
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
295 gaim_signal_connect(gaim_connections_get_handle(), "signing-off",
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
296 gaim_idle_get_handle(),
bd80fb1e8406 [gaim-migrate @ 15173]
Mark Doliner <mark@kingant.net>
parents: 12573
diff changeset
297 GAIM_CALLBACK(signing_off_cb), NULL);
12272
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
298
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
299 gaim_idle_touch();
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
300 }
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
301
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
302 void
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
303 gaim_idle_uninit()
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
304 {
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
305 gaim_signals_disconnect_by_handle(gaim_idle_get_handle());
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
306
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
307 /* Remove the idle timer */
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
308 if (idle_timer > 0)
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
309 gaim_timeout_remove(idle_timer);
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
310 idle_timer = 0;
3ef381cdc47e [gaim-migrate @ 14574]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
311 }