comparison src/server.c @ 8948:175cbf710a47

[gaim-migrate @ 9720] Eradicate the "seconds before resending autoresponse" preference (default to 600 seconds) and the "send autoresponse in active conversations" preference (default to no) committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 16 May 2004 06:39:51 +0000
parents 9a25d7f66d9c
children 80b4c956d7ae
comparison
equal deleted inserted replaced
8947:fa6c2d893c51 8948:175cbf710a47
38 #include "gaim.h" 38 #include "gaim.h"
39 #include "gtkimhtml.h" 39 #include "gtkimhtml.h"
40 #include "gtkutils.h" 40 #include "gtkutils.h"
41 #include "ui.h" 41 #include "ui.h"
42 42
43 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600
44
43 void serv_login(GaimAccount *account) 45 void serv_login(GaimAccount *account)
44 { 46 {
45 GaimPlugin *p = gaim_find_prpl(gaim_account_get_protocol_id(account)); 47 GaimPlugin *p = gaim_find_prpl(gaim_account_get_protocol_id(account));
46 GaimPluginProtocolInfo *prpl_info = NULL; 48 GaimPluginProtocolInfo *prpl_info = NULL;
47 49
199 while (tmp) { 201 while (tmp) {
200 cur = tmp; 202 cur = tmp;
201 tmp = tmp->next; 203 tmp = tmp->next;
202 lar = (struct last_auto_response *)cur->data; 204 lar = (struct last_auto_response *)cur->data;
203 205
204 if ((time(NULL) - lar->sent) > 206 if ((time(NULL) - lar->sent) > SECS_BEFORE_RESENDING_AUTORESPONSE) {
205 gaim_prefs_get_int("/core/away/auto_response/sec_before_resend")) {
206
207 last_auto_responses = g_slist_remove(last_auto_responses, lar); 207 last_auto_responses = g_slist_remove(last_auto_responses, lar);
208 g_free(lar); 208 g_free(lar);
209 } 209 }
210 } 210 }
211 211
217 GSList *tmp; 217 GSList *tmp;
218 struct last_auto_response *lar; 218 struct last_auto_response *lar;
219 219
220 /* because we're modifying or creating a lar, schedule the 220 /* because we're modifying or creating a lar, schedule the
221 * function to expire them as the pref dictates */ 221 * function to expire them as the pref dictates */
222 gaim_timeout_add((gaim_prefs_get_int("/core/away/auto_response/sec_before_resend") + 1) * 1000, 222 gaim_timeout_add((SECS_BEFORE_RESENDING_AUTORESPONSE + 1) * 1000, expire_last_auto_responses, NULL);
223 expire_last_auto_responses, NULL);
224 223
225 tmp = last_auto_responses; 224 tmp = last_auto_responses;
226 225
227 while (tmp) { 226 while (tmp) {
228 lar = (struct last_auto_response *)tmp->data; 227 lar = (struct last_auto_response *)tmp->data;
277 val = prpl_info->send_im(gc, name, message, imflags); 276 val = prpl_info->send_im(gc, name, message, imflags);
278 277
279 if (!(imflags & GAIM_CONV_IM_AUTO_RESP)) 278 if (!(imflags & GAIM_CONV_IM_AUTO_RESP))
280 serv_touch_idle(gc); 279 serv_touch_idle(gc);
281 280
282 if (gc->away && 281 if (gc->away && (gc->flags & GAIM_CONNECTION_AUTO_RESP) &&
283 (gc->flags & GAIM_CONNECTION_AUTO_RESP) && 282 gaim_prefs_get_bool("/core/away/auto_response/enabled")) {
284 gaim_prefs_get_bool("/core/away/auto_response/enabled") &&
285 !gaim_prefs_get_bool("/core/away/auto_response/in_active_conv")) {
286 283
287 struct last_auto_response *lar; 284 struct last_auto_response *lar;
288 lar = get_last_auto_response(gc, name); 285 lar = get_last_auto_response(gc, name);
289 lar->sent = time(NULL); 286 lar->sent = time(NULL);
290 } 287 }
1016 * soon. Besides that, we need to keep track of this even if we've 1013 * soon. Besides that, we need to keep track of this even if we've
1017 * got a queue. So the rest of this block is just the auto-response, 1014 * got a queue. So the rest of this block is just the auto-response,
1018 * if necessary. 1015 * if necessary.
1019 */ 1016 */
1020 lar = get_last_auto_response(gc, name); 1017 lar = get_last_auto_response(gc, name);
1021 if ((t - lar->sent) < 1018 if ((t - lar->sent) < SECS_BEFORE_RESENDING_AUTORESPONSE) {
1022 gaim_prefs_get_int("/core/away/auto_response/sec_before_resend")) {
1023
1024 g_free(name); 1019 g_free(name);
1025 g_free(message); 1020 g_free(message);
1026 return; 1021 return;
1027 } 1022 }
1028 lar->sent = t; 1023 lar->sent = t;