Mercurial > pidgin.yaz
comparison libpurple/server.c @ 32767:2ec94166be43
On the way to hiding the PurpleConnection struct.
* Added purple_connection_get_flags() and purple_connection_set_flags()
* Use purple_connection_ accessor functions.
author | andrew.victor@mxit.com |
---|---|
date | Tue, 18 Oct 2011 18:47:48 +0000 |
parents | fe20ff3d4e7a |
children | 4a34689eeb33 |
comparison
equal
deleted
inserted
replaced
32766:ea2b621fd3ba | 32767:2ec94166be43 |
---|---|
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); |
568 | 568 |
569 /* | 569 /* |
570 * We should update the conversation window buttons and menu, | 570 * We should update the conversation window buttons and menu, |
571 * if it exists. | 571 * if it exists. |
572 */ | 572 */ |
573 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)); |
574 | 574 |
575 /* | 575 /* |
576 * 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 |
577 * to free these strings and replace them with a modifed version. | 577 * to free these strings and replace them with a modifed version. |
578 */ | 578 */ |
579 buffy = g_strdup(msg); | 579 buffy = g_strdup(msg); |
580 angel = g_strdup(who); | 580 angel = g_strdup(who); |
581 | 581 |
582 plugin_return = GPOINTER_TO_INT( | 582 plugin_return = GPOINTER_TO_INT( |
583 purple_signal_emit_return_1(purple_conversations_get_handle(), | 583 purple_signal_emit_return_1(purple_conversations_get_handle(), |
584 "receiving-im-msg", gc->account, | 584 "receiving-im-msg", purple_connection_get_account(gc), |
585 &angel, &buffy, conv, &flags)); | 585 &angel, &buffy, conv, &flags)); |
586 | 586 |
587 if (!buffy || !angel || plugin_return) { | 587 if (!buffy || !angel || plugin_return) { |
588 g_free(buffy); | 588 g_free(buffy); |
589 g_free(angel); | 589 g_free(angel); |
591 } | 591 } |
592 | 592 |
593 name = angel; | 593 name = angel; |
594 message = buffy; | 594 message = buffy; |
595 | 595 |
596 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), |
597 name, message, conv, flags); | 597 name, message, conv, flags); |
598 | 598 |
599 /* 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 */ |
600 if (conv == NULL) | 600 if (conv == NULL) |
601 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)); |
602 | 602 |
603 if (conv == NULL) | 603 if (conv == NULL) |
604 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); | 604 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
605 | 605 |
606 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); |
613 * - we are available | 613 * - we are available |
614 * - or it's disabled | 614 * - or it's disabled |
615 * - 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 |
616 * is set | 616 * is set |
617 */ | 617 */ |
618 if (gc->flags & PURPLE_CONNECTION_AUTO_RESP) | 618 if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_AUTO_RESP) |
619 { | 619 { |
620 PurplePresence *presence; | 620 PurplePresence *presence; |
621 PurpleStatus *status; | 621 PurpleStatus *status; |
622 PurpleStatusType *status_type; | 622 PurpleStatusType *status_type; |
623 PurpleStatusPrimitive primitive; | 623 PurpleStatusPrimitive primitive; |
686 void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, | 686 void serv_got_typing(PurpleConnection *gc, const char *name, int timeout, |
687 PurpleTypingState state) { | 687 PurpleTypingState state) { |
688 PurpleConversation *conv; | 688 PurpleConversation *conv; |
689 PurpleConvIm *im = NULL; | 689 PurpleConvIm *im = NULL; |
690 | 690 |
691 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)); |
692 if (conv != NULL) { | 692 if (conv != NULL) { |
693 im = PURPLE_CONV_IM(conv); | 693 im = PURPLE_CONV_IM(conv); |
694 | 694 |
695 purple_conv_im_set_typing_state(im, state); | 695 purple_conv_im_set_typing_state(im, state); |
696 } else { | 696 } else { |
697 switch (state) | 697 switch (state) |
698 { | 698 { |
699 case PURPLE_TYPING: | 699 case PURPLE_TYPING: |
700 purple_signal_emit(purple_conversations_get_handle(), | 700 purple_signal_emit(purple_conversations_get_handle(), |
701 "buddy-typing", gc->account, name); | 701 "buddy-typing", purple_connection_get_account(gc), name); |
702 break; | 702 break; |
703 case PURPLE_TYPED: | 703 case PURPLE_TYPED: |
704 purple_signal_emit(purple_conversations_get_handle(), | 704 purple_signal_emit(purple_conversations_get_handle(), |
705 "buddy-typed", gc->account, name); | 705 "buddy-typed", purple_connection_get_account(gc), name); |
706 break; | 706 break; |
707 case PURPLE_NOT_TYPING: | 707 case PURPLE_NOT_TYPING: |
708 purple_signal_emit(purple_conversations_get_handle(), | 708 purple_signal_emit(purple_conversations_get_handle(), |
709 "buddy-typing-stopped", gc->account, name); | 709 "buddy-typing-stopped", purple_connection_get_account(gc), name); |
710 break; | 710 break; |
711 } | 711 } |
712 } | 712 } |
713 | 713 |
714 if (conv != NULL && timeout > 0) | 714 if (conv != NULL && timeout > 0) |
718 void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { | 718 void serv_got_typing_stopped(PurpleConnection *gc, const char *name) { |
719 | 719 |
720 PurpleConversation *conv; | 720 PurpleConversation *conv; |
721 PurpleConvIm *im; | 721 PurpleConvIm *im; |
722 | 722 |
723 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)); |
724 if (conv != NULL) | 724 if (conv != NULL) |
725 { | 725 { |
726 im = PURPLE_CONV_IM(conv); | 726 im = PURPLE_CONV_IM(conv); |
727 | 727 |
728 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) | 728 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) |
732 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); | 732 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING); |
733 } | 733 } |
734 else | 734 else |
735 { | 735 { |
736 purple_signal_emit(purple_conversations_get_handle(), | 736 purple_signal_emit(purple_conversations_get_handle(), |
737 "buddy-typing-stopped", gc->account, name); | 737 "buddy-typing-stopped", purple_connection_get_account(gc), name); |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 struct chat_invite_data { | 741 struct chat_invite_data { |
742 PurpleConnection *gc; | 742 PurpleConnection *gc; |
923 buffy = g_strdup(message); | 923 buffy = g_strdup(message); |
924 angel = g_strdup(who); | 924 angel = g_strdup(who); |
925 | 925 |
926 plugin_return = GPOINTER_TO_INT( | 926 plugin_return = GPOINTER_TO_INT( |
927 purple_signal_emit_return_1(purple_conversations_get_handle(), | 927 purple_signal_emit_return_1(purple_conversations_get_handle(), |
928 "receiving-chat-msg", g->account, | 928 "receiving-chat-msg", purple_connection_get_account(g), |
929 &angel, &buffy, conv, &flags)); | 929 &angel, &buffy, conv, &flags)); |
930 | 930 |
931 if (!buffy || !angel || plugin_return) { | 931 if (!buffy || !angel || plugin_return) { |
932 g_free(buffy); | 932 g_free(buffy); |
933 g_free(angel); | 933 g_free(angel); |
935 } | 935 } |
936 | 936 |
937 who = angel; | 937 who = angel; |
938 message = buffy; | 938 message = buffy; |
939 | 939 |
940 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), |
941 who, message, conv, flags); | 941 who, message, conv, flags); |
942 | 942 |
943 purple_conv_chat_write(chat, who, message, flags, mtime); | 943 purple_conv_chat_write(chat, who, message, flags, mtime); |
944 | 944 |
945 g_free(angel); | 945 g_free(angel); |