Mercurial > pidgin.yaz
comparison libpurple/server.c @ 29471:d83ee160ffb6
propagate from branch 'im.pidgin.pidgin' (head eb9385f349a20856b9d3f9911dbc8024caa44052)
to branch 'im.pidgin.pidgin.next.minor' (head 439fb2dd7a285d9ca645f65f36ef0f037abe7311)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Wed, 19 Aug 2009 00:46:04 +0000 |
parents | 2ee64cfbbe2e |
children | 4a2adf413aaa dab0d17dc6c1 |
comparison
equal
deleted
inserted
replaced
29470:7a3458436140 | 29471:d83ee160ffb6 |
---|---|
585 | 585 |
586 g_return_if_fail(msg != NULL); | 586 g_return_if_fail(msg != NULL); |
587 | 587 |
588 account = purple_connection_get_account(gc); | 588 account = purple_connection_get_account(gc); |
589 | 589 |
590 if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->set_permit_deny == NULL) { | 590 /* |
591 /* protocol does not support privacy, handle it ourselves */ | 591 * XXX: Should we be setting this here, or relying on prpls to set it? |
592 if (!purple_privacy_check(account, who)) { | 592 */ |
593 purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg", | 593 flags |= PURPLE_MESSAGE_RECV; |
594 account, who, msg, flags, (unsigned int)mtime); | 594 |
595 return; | 595 if (!purple_privacy_check(account, who)) { |
596 } | 596 purple_signal_emit(purple_conversations_get_handle(), "blocked-im-msg", |
597 account, who, msg, flags, (unsigned int)mtime); | |
598 return; | |
597 } | 599 } |
598 | 600 |
599 /* | 601 /* |
600 * We should update the conversation window buttons and menu, | 602 * We should update the conversation window buttons and menu, |
601 * if it exists. | 603 * if it exists. |
627 name, message, conv, flags); | 629 name, message, conv, flags); |
628 | 630 |
629 /* search for conversation again in case it was created by received-im-msg handler */ | 631 /* search for conversation again in case it was created by received-im-msg handler */ |
630 if (conv == NULL) | 632 if (conv == NULL) |
631 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); | 633 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); |
632 | |
633 /* | |
634 * XXX: Should we be setting this here, or relying on prpls to set it? | |
635 */ | |
636 flags |= PURPLE_MESSAGE_RECV; | |
637 | 634 |
638 if (conv == NULL) | 635 if (conv == NULL) |
639 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); | 636 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
640 | 637 |
641 purple_conv_im_write(PURPLE_CONV_IM(conv), name, message, flags, mtime); | 638 purple_conv_im_write(PURPLE_CONV_IM(conv), name, message, flags, mtime); |
726 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); | 723 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); |
727 if (conv != NULL) { | 724 if (conv != NULL) { |
728 im = PURPLE_CONV_IM(conv); | 725 im = PURPLE_CONV_IM(conv); |
729 | 726 |
730 purple_conv_im_set_typing_state(im, state); | 727 purple_conv_im_set_typing_state(im, state); |
731 purple_conv_im_update_typing(im); | |
732 } else { | 728 } else { |
733 switch (state) | 729 switch (state) |
734 { | 730 { |
735 case PURPLE_TYPING: | 731 case PURPLE_TYPING: |
736 purple_signal_emit(purple_conversations_get_handle(), | 732 purple_signal_emit(purple_conversations_get_handle(), |
764 if (im->typing_state == PURPLE_NOT_TYPING) | 760 if (im->typing_state == PURPLE_NOT_TYPING) |
765 return; | 761 return; |
766 | 762 |
767 purple_conv_im_stop_typing_timeout(im); | 763 purple_conv_im_stop_typing_timeout(im); |
768 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); | 764 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); |
769 purple_conv_im_update_typing(im); | |
770 } | 765 } |
771 else | 766 else |
772 { | 767 { |
773 purple_signal_emit(purple_conversations_get_handle(), | 768 purple_signal_emit(purple_conversations_get_handle(), |
774 "buddy-typing-stopped", gc->account, name); | 769 "buddy-typing-stopped", gc->account, name); |
862 PurpleConvChat *chat; | 857 PurpleConvChat *chat; |
863 PurpleAccount *account; | 858 PurpleAccount *account; |
864 | 859 |
865 account = purple_connection_get_account(gc); | 860 account = purple_connection_get_account(gc); |
866 | 861 |
862 g_return_val_if_fail(account != NULL, NULL); | |
863 g_return_val_if_fail(name != NULL, NULL); | |
864 | |
867 conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); | 865 conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name); |
866 g_return_val_if_fail(conv != NULL, NULL); | |
867 | |
868 chat = PURPLE_CONV_CHAT(conv); | 868 chat = PURPLE_CONV_CHAT(conv); |
869 | 869 |
870 if (!g_slist_find(gc->buddy_chats, conv)) | 870 if (!g_slist_find(gc->buddy_chats, conv)) |
871 gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); | 871 gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); |
872 | 872 |
936 conv = NULL; | 936 conv = NULL; |
937 } | 937 } |
938 | 938 |
939 if (!conv) | 939 if (!conv) |
940 return; | 940 return; |
941 | |
942 /* Did I send the message? */ | |
943 if (purple_strequal(purple_conv_chat_get_nick(chat), | |
944 purple_normalize(purple_conversation_get_account(conv), who))) { | |
945 flags |= PURPLE_MESSAGE_SEND; | |
946 flags &= ~PURPLE_MESSAGE_RECV; /* Just in case some prpl sets it! */ | |
947 } else { | |
948 flags |= PURPLE_MESSAGE_RECV; | |
949 } | |
941 | 950 |
942 /* | 951 /* |
943 * Make copies of the message and the sender in case plugins want | 952 * Make copies of the message and the sender in case plugins want |
944 * to free these strings and replace them with a modifed version. | 953 * to free these strings and replace them with a modifed version. |
945 */ | 954 */ |