Mercurial > pidgin
comparison libpurple/server.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 2ec94166be43 |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
147 /* | 147 /* |
148 * XXX - If "only auto-reply when away & idle" is set, then shouldn't | 148 * XXX - If "only auto-reply when away & idle" is set, then shouldn't |
149 * this only reset lar->sent if we're away AND idle? | 149 * this only reset lar->sent if we're away AND idle? |
150 */ | 150 */ |
151 auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); | 151 auto_reply_pref = purple_prefs_get_string("/purple/away/auto_reply"); |
152 if((gc->flags & PURPLE_CONNECTION_AUTO_RESP) && | 152 if((purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) && |
153 !purple_presence_is_available(presence) && | 153 !purple_presence_is_available(presence) && |
154 !purple_strequal(auto_reply_pref, "never")) { | 154 !purple_strequal(auto_reply_pref, "never")) { |
155 | 155 |
156 struct last_auto_response *lar; | 156 struct last_auto_response *lar; |
157 lar = get_last_auto_response(gc, name); | 157 lar = get_last_auto_response(gc, name); |
321 } else { | 321 } else { |
322 attn = NULL; | 322 attn = NULL; |
323 } | 323 } |
324 | 324 |
325 return attn; | 325 return attn; |
326 } | |
327 | |
328 void | |
329 serv_send_attention(PurpleConnection *gc, const char *who, guint type_code) | |
330 { | |
331 purple_prpl_send_attention(gc, who, type_code); | |
332 } | |
333 | |
334 void | |
335 serv_got_attention(PurpleConnection *gc, const char *who, guint type_code) | |
336 { | |
337 purple_prpl_got_attention(gc, who, type_code); | |
338 } | 326 } |
339 | 327 |
340 | 328 |
341 /* | 329 /* |
342 * Move a buddy from one group to another on server. | 330 * Move a buddy from one group to another on server. |
580 | 568 |
581 /* | 569 /* |
582 * We should update the conversation window buttons and menu, | 570 * We should update the conversation window buttons and menu, |
583 * if it exists. | 571 * if it exists. |
584 */ | 572 */ |
585 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account); | 573 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, purple_connection_get_account(gc)); |
586 | 574 |
587 /* | 575 /* |
588 * Make copies of the message and the sender in case plugins want | 576 * Make copies of the message and the sender in case plugins want |
589 * to free these strings and replace them with a modifed version. | 577 * to free these strings and replace them with a modifed version. |
590 */ | 578 */ |
591 buffy = g_strdup(msg); | 579 buffy = g_strdup(msg); |
592 angel = g_strdup(who); | 580 angel = g_strdup(who); |
593 | 581 |
594 plugin_return = GPOINTER_TO_INT( | 582 plugin_return = GPOINTER_TO_INT( |
595 purple_signal_emit_return_1(purple_conversations_get_handle(), | 583 purple_signal_emit_return_1(purple_conversations_get_handle(), |
596 "receiving-im-msg", gc->account, | 584 "receiving-im-msg", purple_connection_get_account(gc), |
597 &angel, &buffy, conv, &flags)); | 585 &angel, &buffy, conv, &flags)); |
598 | 586 |
599 if (!buffy || !angel || plugin_return) { | 587 if (!buffy || !angel || plugin_return) { |
600 g_free(buffy); | 588 g_free(buffy); |
601 g_free(angel); | 589 g_free(angel); |
603 } | 591 } |
604 | 592 |
605 name = angel; | 593 name = angel; |
606 message = buffy; | 594 message = buffy; |
607 | 595 |
608 purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account, | 596 purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", purple_connection_get_account(gc), |
609 name, message, conv, flags); | 597 name, message, conv, flags); |
610 | 598 |
611 /* search for conversation again in case it was created by received-im-msg handler */ | 599 /* search for conversation again in case it was created by received-im-msg handler */ |
612 if (conv == NULL) | 600 if (conv == NULL) |
613 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); | 601 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); |
614 | 602 |
615 if (conv == NULL) | 603 if (conv == NULL) |
616 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); | 604 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
617 | 605 |
618 purple_conv_im_write(PURPLE_CONV_IM(conv), name, message, flags, mtime); | 606 purple_conv_im_write(PURPLE_CONV_IM(conv), name, message, flags, mtime); |
625 * - we are available | 613 * - we are available |
626 * - or it's disabled | 614 * - or it's disabled |
627 * - or we're not idle and the 'only auto respond if idle' pref | 615 * - or we're not idle and the 'only auto respond if idle' pref |
628 * is set | 616 * is set |
629 */ | 617 */ |
630 if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) | 618 if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) |
631 { | 619 { |
632 PurplePresence *presence; | 620 PurplePresence *presence; |
633 PurpleStatus *status; | 621 PurpleStatus *status; |
634 PurpleStatusType *status_type; | 622 PurpleStatusType *status_type; |
635 PurpleStatusPrimitive primitive; | 623 PurpleStatusPrimitive primitive; |
698 void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, | 686 void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, |
699 PurpleTypingState state) { | 687 PurpleTypingState state) { |
700 PurpleConversation *conv; | 688 PurpleConversation *conv; |
701 PurpleConvIm *im = NULL; | 689 PurpleConvIm *im = NULL; |
702 | 690 |
703 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account); | 691 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, purple_connection_get_account(gc)); |
704 if (conv != NULL) { | 692 if (conv != NULL) { |
705 im = PURPLE_CONV_IM(conv); | 693 im = PURPLE_CONV_IM(conv); |
706 | 694 |
707 purple_conv_im_set_typing_state(im, state); | 695 purple_conv_im_set_typing_state(im, state); |
708 } else { | 696 } else { |
709 switch (state) | 697 switch (state) |
710 { | 698 { |
711 case PURPLE_TYPING: | 699 case PURPLE_TYPING: |
712 purple_signal_emit(purple_conversations_get_handle(), | 700 purple_signal_emit(purple_conversations_get_handle(), |
713 "buddy-typing", gc->account, name); | 701 "buddy-typing", purple_connection_get_account(gc), name); |
714 break; | 702 break; |
715 case PURPLE_TYPED: | 703 case PURPLE_TYPED: |
716 purple_signal_emit(purple_conversations_get_handle(), | 704 purple_signal_emit(purple_conversations_get_handle(), |
717 "buddy-typed", gc->account, name); | 705 "buddy-typed", purple_connection_get_account(gc), name); |
718 break; | 706 break; |
719 case PURPLE_NOT_TYPING: | 707 case PURPLE_NOT_TYPING: |
720 purple_signal_emit(purple_conversations_get_handle(), | 708 purple_signal_emit(purple_conversations_get_handle(), |
721 "buddy-typing-stopped", gc->account, name); | 709 "buddy-typing-stopped", purple_connection_get_account(gc), name); |
722 break; | 710 break; |
723 } | 711 } |
724 } | 712 } |
725 | 713 |
726 if (conv != NULL && timeout > 0) | 714 if (conv != NULL && timeout > 0) |
730 void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { | 718 void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { |
731 | 719 |
732 PurpleConversation *conv; | 720 PurpleConversation *conv; |
733 PurpleConvIm *im; | 721 PurpleConvIm *im; |
734 | 722 |
735 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, purple_connection_get_account(gc)); |
736 if (conv != NULL) | 724 if (conv != NULL) |
737 { | 725 { |
738 im = PURPLE_CONV_IM(conv); | 726 im = PURPLE_CONV_IM(conv); |
739 | 727 |
740 if (im->typing_state == PURPLE_NOT_TYPING) | 728 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) |
741 return; | 729 return; |
742 | 730 |
743 purple_conv_im_stop_typing_timeout(im); | 731 purple_conv_im_stop_typing_timeout(im); |
744 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); | 732 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); |
745 } | 733 } |
746 else | 734 else |
747 { | 735 { |
748 purple_signal_emit(purple_conversations_get_handle(), | 736 purple_signal_emit(purple_conversations_get_handle(), |
749 "buddy-typing-stopped", gc->account, name); | 737 "buddy-typing-stopped", purple_connection_get_account(gc), name); |
750 } | 738 } |
751 } | 739 } |
752 | 740 |
753 struct chat_invite_data { | 741 struct chat_invite_data { |
754 PurpleConnection *gc; | 742 PurpleConnection *gc; |
935 buffy = g_strdup(message); | 923 buffy = g_strdup(message); |
936 angel = g_strdup(who); | 924 angel = g_strdup(who); |
937 | 925 |
938 plugin_return = GPOINTER_TO_INT( | 926 plugin_return = GPOINTER_TO_INT( |
939 purple_signal_emit_return_1(purple_conversations_get_handle(), | 927 purple_signal_emit_return_1(purple_conversations_get_handle(), |
940 "receiving-chat-msg", g->account, | 928 "receiving-chat-msg", purple_connection_get_account(g), |
941 &angel, &buffy, conv, &flags)); | 929 &angel, &buffy, conv, &flags)); |
942 | 930 |
943 if (!buffy || !angel || plugin_return) { | 931 if (!buffy || !angel || plugin_return) { |
944 g_free(buffy); | 932 g_free(buffy); |
945 g_free(angel); | 933 g_free(angel); |
947 } | 935 } |
948 | 936 |
949 who = angel; | 937 who = angel; |
950 message = buffy; | 938 message = buffy; |
951 | 939 |
952 purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account, | 940 purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", purple_connection_get_account(g), |
953 who, message, conv, flags); | 941 who, message, conv, flags); |
954 | 942 |
955 purple_conv_chat_write(chat, who, message, flags, mtime); | 943 purple_conv_chat_write(chat, who, message, flags, mtime); |
956 | 944 |
957 g_free(angel); | 945 g_free(angel); |