Mercurial > pidgin
comparison src/server.c @ 11706:bcc49c25ef90
[gaim-migrate @ 13997]
Generalize the buddy-typing and buddy-typing-stopped signals.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Fri, 21 Oct 2005 19:03:51 +0000 |
| parents | eb14bbcf7249 |
| children | cae2fb7e8594 |
comparison
equal
deleted
inserted
replaced
| 11705:0906a3e9626c | 11706:bcc49c25ef90 |
|---|---|
| 785 g_free(message); | 785 g_free(message); |
| 786 } | 786 } |
| 787 | 787 |
| 788 void serv_got_typing(GaimConnection *gc, const char *name, int timeout, | 788 void serv_got_typing(GaimConnection *gc, const char *name, int timeout, |
| 789 GaimTypingState state) { | 789 GaimTypingState state) { |
| 790 | 790 GaimConversation *conv; |
| 791 GaimBuddy *b; | |
| 792 GaimConversation *cnv; | |
| 793 GaimConvIm *im; | 791 GaimConvIm *im; |
| 794 | 792 |
| 795 cnv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); | 793 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); |
| 796 if (!cnv) | 794 if (conv != NULL) { |
| 797 return; | 795 im = GAIM_CONV_IM(conv); |
| 798 | 796 |
| 799 im = GAIM_CONV_IM(cnv); | 797 gaim_conversation_set_account(conv, gc->account); |
| 800 | 798 gaim_conv_im_set_typing_state(im, state); |
| 801 gaim_conversation_set_account(cnv, gc->account); | 799 gaim_conv_im_update_typing(im); |
| 802 gaim_conv_im_set_typing_state(im, state); | 800 } |
| 803 gaim_conv_im_update_typing(im); | 801 |
| 804 | 802 if (state == GAIM_TYPING) |
| 805 b = gaim_find_buddy(gc->account, name); | |
| 806 | |
| 807 if (b != NULL) | |
| 808 { | |
| 809 if (state == GAIM_TYPING) | |
| 810 { | |
| 811 gaim_signal_emit(gaim_conversations_get_handle(), | |
| 812 "buddy-typing", cnv); | |
| 813 } | |
| 814 else | |
| 815 { | |
| 816 gaim_signal_emit(gaim_conversations_get_handle(), | |
| 817 "buddy-typing-stopped", cnv); | |
| 818 } | |
| 819 } | |
| 820 | |
| 821 if (timeout > 0) | |
| 822 gaim_conv_im_start_typing_timeout(im, timeout); | |
| 823 } | |
| 824 | |
| 825 void serv_got_typing_stopped(GaimConnection *gc, const char *name) { | |
| 826 | |
| 827 GaimConversation *c; | |
| 828 GaimConvIm *im; | |
| 829 GaimBuddy *b; | |
| 830 | |
| 831 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); | |
| 832 if (!c) | |
| 833 return; | |
| 834 | |
| 835 im = GAIM_CONV_IM(c); | |
| 836 | |
| 837 if (im->typing_state == GAIM_NOT_TYPING) | |
| 838 return; | |
| 839 | |
| 840 gaim_conv_im_stop_typing_timeout(im); | |
| 841 gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); | |
| 842 gaim_conv_im_update_typing(im); | |
| 843 | |
| 844 b = gaim_find_buddy(gc->account, name); | |
| 845 | |
| 846 if (b != NULL) | |
| 847 { | 803 { |
| 848 gaim_signal_emit(gaim_conversations_get_handle(), | 804 gaim_signal_emit(gaim_conversations_get_handle(), |
| 849 "buddy-typing-stopped", c); | 805 "buddy-typing", gc->account, name); |
| 850 } | 806 } |
| 807 else | |
| 808 { | |
| 809 gaim_signal_emit(gaim_conversations_get_handle(), | |
| 810 "buddy-typing-stopped", gc->account, name); | |
| 811 } | |
| 812 | |
| 813 if (conv != NULL && timeout > 0) | |
| 814 gaim_conv_im_start_typing_timeout(im, timeout); | |
| 815 } | |
| 816 | |
| 817 void serv_got_typing_stopped(GaimConnection *gc, const char *name) { | |
| 818 | |
| 819 GaimConversation *conv; | |
| 820 GaimConvIm *im; | |
| 821 | |
| 822 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); | |
| 823 if (conv != NULL) | |
| 824 { | |
| 825 im = GAIM_CONV_IM(conv); | |
| 826 | |
| 827 if (im->typing_state == GAIM_NOT_TYPING) | |
| 828 return; | |
| 829 | |
| 830 gaim_conv_im_stop_typing_timeout(im); | |
| 831 gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); | |
| 832 gaim_conv_im_update_typing(im); | |
| 833 } | |
| 834 | |
| 835 gaim_signal_emit(gaim_conversations_get_handle(), | |
| 836 "buddy-typing-stopped", gc->account, name); | |
| 851 } | 837 } |
| 852 | 838 |
| 853 struct chat_invite_data { | 839 struct chat_invite_data { |
| 854 GaimConnection *gc; | 840 GaimConnection *gc; |
| 855 GHashTable *components; | 841 GHashTable *components; |
