comparison src/gtkidle.c @ 12125:3c1bac709234

[gaim-migrate @ 14425] Change /core/savedstatus/current and /core/savedstatus/idleaway to ints (they used to be strings, where the value was the title of a GaimSavedStatus). The value is now equal to the "creation" timestamp of a saved_status. The creation timestamp is used as the unique key. The primary reason for this is to allow for saved statuses to have NULL titles. NULL titles are needed for transient statuses. I also added a "last_used" timestamp. This all paves the way for keeping track of recently used statuses committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Nov 2005 07:23:29 +0000
parents 355c7acbb61d
children 891aeb151590
comparison
equal deleted inserted replaced
12124:9c123e27e2f6 12125:3c1bac709234
157 (idle_time > (60 * gaim_prefs_get_int("/core/away/mins_before_away"))) 157 (idle_time > (60 * gaim_prefs_get_int("/core/away/mins_before_away")))
158 && (!gc->is_auto_away)) 158 && (!gc->is_auto_away))
159 { 159 {
160 if (gaim_presence_is_available(presence)) 160 if (gaim_presence_is_available(presence))
161 { 161 {
162 const char *idleaway_name;
163 GaimSavedStatus *saved_status; 162 GaimSavedStatus *saved_status;
164 163
165 gaim_debug_info("idle", "Making %s auto-away\n", 164 gaim_debug_info("idle", "Making %s auto-away\n",
166 gaim_account_get_username(account)); 165 gaim_account_get_username(account));
167 166
168 /* Mark our accounts "away" using the idleaway status */ 167 /* Mark our accounts "away" using the idleaway status */
169 idleaway_name = gaim_prefs_get_string("/core/savedstatus/idleaway"); 168 saved_status = gaim_savedstatus_get_idleaway();
170 saved_status = gaim_savedstatus_find(idleaway_name); 169 gaim_savedstatus_activate_for_account(saved_status, account);
171 if (saved_status)
172 gaim_savedstatus_activate_for_account(saved_status, account);
173 170
174 gc->is_auto_away = GAIM_IDLE_AUTO_AWAY; 171 gc->is_auto_away = GAIM_IDLE_AUTO_AWAY;
175 } else { 172 } else {
176 gc->is_auto_away = GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY; 173 gc->is_auto_away = GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY;
177 } 174 }
178 175
179 } else if (gc->is_auto_away && 176 } else if (gc->is_auto_away &&
180 idle_time < 60 * gaim_prefs_get_int("/core/away/mins_before_away")) 177 idle_time < 60 * gaim_prefs_get_int("/core/away/mins_before_away"))
181 { 178 {
182 /* Return from being idle */ 179 /* Return from being idle */
183 const char *idleaway_name;
184 GaimSavedStatus *saved_status; 180 GaimSavedStatus *saved_status;
185 181
186 if (gc->is_auto_away == GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY) { 182 if (gc->is_auto_away == GAIM_IDLE_AWAY_BUT_NOT_AUTO_AWAY) {
187 gc->is_auto_away = GAIM_IDLE_NOT_AWAY; 183 gc->is_auto_away = GAIM_IDLE_NOT_AWAY;
188 } else { 184 } else {
190 186
191 gaim_debug_info("idle", "%s returning from auto-away\n", 187 gaim_debug_info("idle", "%s returning from auto-away\n",
192 gaim_account_get_username(account)); 188 gaim_account_get_username(account));
193 189
194 /* Return our account to its previous status */ 190 /* Return our account to its previous status */
195 idleaway_name = gaim_prefs_get_string("/core/savedstatus/current"); 191 saved_status = gaim_savedstatus_get_idleaway();
196 saved_status = gaim_savedstatus_find(idleaway_name); 192 gaim_savedstatus_activate_for_account(saved_status, account);
197 if (saved_status)
198 gaim_savedstatus_activate_for_account(saved_status, account);
199 } 193 }
200 } 194 }
201 /* End of auto-away stuff */ 195 /* End of auto-away stuff */
202 196
203 /* Begining of idle reporting stuff */ 197 /* Begining of idle reporting stuff */