comparison src/server.c @ 11907:d2db6426c88a

[gaim-migrate @ 14198] sf patch #1342817, from Evan Schoenberg "As discussed in #gaim, this patch removes idle.c and replaces it with gtkidle.c and gtkidle.h. The attached diff removes the idle management from its various hiding places in connection.c, server.c, and gaim.h. The plugins Changelog.API is appropriately updated. The new gtkidle files are attached; idle.c should be removed from CVS." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 30 Oct 2005 23:00:47 +0000
parents c9312177821a
children aadf61b30056
comparison
equal deleted inserted replaced
11906:8913546c6a4e 11907:d2db6426c88a
39 #include "gtkutils.h" 39 #include "gtkutils.h"
40 40
41 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 41 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600
42 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" 42 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married"
43 43
44 void serv_touch_idle(GaimConnection *gc)
45 {
46 /* Are we idle? If so, not anymore */
47 if (gc->is_idle > 0) {
48 gc->is_idle = 0;
49 serv_set_idle(gc, 0);
50 }
51 time(&gc->last_sent_time);
52 if (gc->is_auto_away)
53 check_idle(gc);
54 }
55
56 /* This should return the elapsed time in seconds in which Gaim will not send 44 /* This should return the elapsed time in seconds in which Gaim will not send
57 * typing notifications. 45 * typing notifications.
58 * if it returns zero, it will not send any more typing notifications 46 * if it returns zero, it will not send any more typing notifications
59 * typing is a flag - TRUE for typing, FALSE for stopped typing */ 47 * typing is a flag - TRUE for typing, FALSE for stopped typing */
60 int serv_send_typing(GaimConnection *g, const char *name, int typing) { 48 int serv_send_typing(GaimConnection *g, const char *name, int typing) {
147 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); 135 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account);
148 136
149 if (prpl_info && prpl_info->send_im) 137 if (prpl_info && prpl_info->send_im)
150 val = prpl_info->send_im(gc, name, message, imflags); 138 val = prpl_info->send_im(gc, name, message, imflags);
151 139
140 /* Only update the last_sent_time if the user actually sent the message */
152 if (!(imflags & GAIM_CONV_IM_AUTO_RESP)) 141 if (!(imflags & GAIM_CONV_IM_AUTO_RESP))
153 serv_touch_idle(gc); 142 time(&gc->last_sent_time);
154 143
155 /* 144 /*
156 * XXX - If "only auto-reply when away & idle" is set, then shouldn't 145 * XXX - If "only auto-reply when away & idle" is set, then shouldn't
157 * this only reset lar->sent if we're away AND idle? 146 * this only reset lar->sent if we're away AND idle?
158 */ 147 */
426 415
427 if (prpl_info && prpl_info->chat_whisper) 416 if (prpl_info && prpl_info->chat_whisper)
428 prpl_info->chat_whisper(g, id, who, message); 417 prpl_info->chat_whisper(g, id, who, message);
429 } 418 }
430 419
431 int serv_chat_send(GaimConnection *g, int id, const char *message) 420 int serv_chat_send(GaimConnection *gc, int id, const char *message)
432 { 421 {
433 int val = -EINVAL; 422 int val = -EINVAL;
434 GaimPluginProtocolInfo *prpl_info = NULL; 423 GaimPluginProtocolInfo *prpl_info = NULL;
435 424
436 if (g->prpl != NULL) 425 if (gc->prpl != NULL)
437 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 426 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
438 427
439 if (prpl_info && prpl_info->chat_send) 428 if (prpl_info && prpl_info->chat_send)
440 val = prpl_info->chat_send(g, id, message); 429 val = prpl_info->chat_send(gc, id, message);
441 430
442 serv_touch_idle(g); 431 time(&gc->last_sent_time);
443 432
444 return val; 433 return val;
445 } 434 }
446 435
447 void serv_set_buddyicon(GaimConnection *gc, const char *filename) 436 void serv_set_buddyicon(GaimConnection *gc, const char *filename)