Mercurial > pidgin
comparison src/server.c @ 13842:a9ff4499d9ce
[gaim-migrate @ 16295]
Hopefully improve the typing notification code so it's a lot easier
to understand. This also creates a distinction between the signals
emitted when receiving GAIM_TYPED and GAIM_NOT_TYPING messages
(by adding a gaim-typed signal). And the gaim-not-typing signal
should work in all cases.
Most of this is stuff I changed last week during work, thanks to
Meebo
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 20 Jun 2006 08:17:49 +0000 |
parents | 99688ab310c8 |
children | 7d513e44201b |
comparison
equal
deleted
inserted
replaced
13841:f3d4a9902ead | 13842:a9ff4499d9ce |
---|---|
36 #include "util.h" | 36 #include "util.h" |
37 | 37 |
38 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 | 38 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 |
39 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" | 39 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" |
40 | 40 |
41 /* This should return the elapsed time in seconds in which Gaim will not send | 41 unsigned int |
42 * typing notifications. | 42 serv_send_typing(GaimConnection *gc, const char *name, GaimTypingState state) |
43 * if it returns zero, it will not send any more typing notifications | 43 { |
44 * typing is a flag - TRUE for typing, FALSE for stopped typing */ | 44 GaimPluginProtocolInfo *prpl_info = NULL; |
45 int serv_send_typing(GaimConnection *g, const char *name, int typing) { | 45 |
46 GaimPluginProtocolInfo *prpl_info = NULL; | 46 if (gc != NULL && gc->prpl != NULL) |
47 | 47 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); |
48 if (g != NULL && g->prpl != NULL) | 48 |
49 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); | 49 if (prpl_info && prpl_info->send_typing) |
50 | 50 return prpl_info->send_typing(gc, name, state); |
51 if (g && prpl_info && prpl_info->send_typing) | |
52 return prpl_info->send_typing(g, name, typing); | |
53 | 51 |
54 return 0; | 52 return 0; |
55 } | 53 } |
56 | 54 |
57 static GSList *last_auto_responses = NULL; | 55 static GSList *last_auto_responses = NULL; |
148 struct last_auto_response *lar; | 146 struct last_auto_response *lar; |
149 lar = get_last_auto_response(gc, name); | 147 lar = get_last_auto_response(gc, name); |
150 lar->sent = time(NULL); | 148 lar->sent = time(NULL); |
151 } | 149 } |
152 | 150 |
153 if (conv && gaim_conv_im_get_type_again_timeout(GAIM_CONV_IM(conv))) | 151 if (conv && gaim_conv_im_get_send_typed_timeout(GAIM_CONV_IM(conv))) |
154 gaim_conv_im_stop_type_again_timeout(GAIM_CONV_IM(conv)); | 152 gaim_conv_im_stop_send_typed_timeout(GAIM_CONV_IM(conv)); |
155 | 153 |
156 return val; | 154 return val; |
157 } | 155 } |
158 | 156 |
159 void serv_get_info(GaimConnection *gc, const char *name) | 157 void serv_get_info(GaimConnection *gc, const char *name) |
591 "buddy-typing", gc->account, name); | 589 "buddy-typing", gc->account, name); |
592 } | 590 } |
593 else | 591 else |
594 { | 592 { |
595 gaim_signal_emit(gaim_conversations_get_handle(), | 593 gaim_signal_emit(gaim_conversations_get_handle(), |
596 "buddy-typing-stopped", gc->account, name); | 594 "buddy-typed", gc->account, name); |
597 } | 595 } |
598 } | 596 } |
599 | 597 |
600 if (conv != NULL && timeout > 0) | 598 if (conv != NULL && timeout > 0) |
601 gaim_conv_im_start_typing_timeout(im, timeout); | 599 gaim_conv_im_start_typing_timeout(im, timeout); |
615 return; | 613 return; |
616 | 614 |
617 gaim_conv_im_stop_typing_timeout(im); | 615 gaim_conv_im_stop_typing_timeout(im); |
618 gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); | 616 gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); |
619 gaim_conv_im_update_typing(im); | 617 gaim_conv_im_update_typing(im); |
618 } | |
619 else | |
620 { | |
621 gaim_signal_emit(gaim_conversations_get_handle(), | |
622 "buddy-typing-stopped", gc->account, name); | |
620 } | 623 } |
621 | 624 |
622 gaim_signal_emit(gaim_conversations_get_handle(), | 625 gaim_signal_emit(gaim_conversations_get_handle(), |
623 "buddy-typing-stopped", gc->account, name); | 626 "buddy-typing-stopped", gc->account, name); |
624 } | 627 } |