comparison libpurple/protocols/msn/slp.c @ 23556:7fc1fa02184a

When receiving an MSN custom smiley, look at the switchboard for the PurpleConversation, instead of searching for it. This should make receiving a smiley in a chat go to the chat window, instead of opening a new conversation with the buddy. References #3264.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 29 Jun 2008 19:17:26 +0000
parents efa4534fd23a
children cab5420c3879
comparison
equal deleted inserted replaced
23555:9b58bc7adfc7 23556:7fc1fa02184a
780 780
781 static void 781 static void
782 got_emoticon(MsnSlpCall *slpcall, 782 got_emoticon(MsnSlpCall *slpcall,
783 const guchar *data, gsize size) 783 const guchar *data, gsize size)
784 { 784 {
785
786 PurpleConversation *conv; 785 PurpleConversation *conv;
787 PurpleConnection *gc; 786 MsnSwitchBoard *swboard;
788 const char *who; 787
789 788 swboard = slpcall->slplink->swboard;
790 gc = slpcall->slplink->session->account->gc; 789 conv = swboard->conv;
791 who = slpcall->slplink->remote_user; 790
792 791 if (conv) {
793 if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, gc->account))) {
794
795 /* FIXME: it would be better if we wrote the data as we received it 792 /* FIXME: it would be better if we wrote the data as we received it
796 instead of all at once, calling write multiple times and 793 instead of all at once, calling write multiple times and
797 close once at the very end 794 close once at the very end
798 */ 795 */
799 purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size); 796 purple_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
807 void 804 void
808 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 805 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
809 { 806 {
810 MsnSession *session; 807 MsnSession *session;
811 MsnSlpLink *slplink; 808 MsnSlpLink *slplink;
809 MsnSwitchBoard *swboard;
812 MsnObject *obj; 810 MsnObject *obj;
813 char **tokens; 811 char **tokens;
814 char *smile, *body_str; 812 char *smile, *body_str;
815 const char *body, *who, *sha1; 813 const char *body, *who, *sha1;
816 guint tok; 814 guint tok;
846 who = msn_object_get_creator(obj); 844 who = msn_object_get_creator(obj);
847 sha1 = msn_object_get_sha1(obj); 845 sha1 = msn_object_get_sha1(obj);
848 846
849 slplink = msn_session_get_slplink(session, who); 847 slplink = msn_session_get_slplink(session, who);
850 848
851 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, who, 849 swboard = cmdproc->data;
852 session->account); 850 slplink->swboard = swboard;
851 conv = swboard->conv;
853 852
854 /* If the conversation doesn't exist then this is a custom smiley 853 /* If the conversation doesn't exist then this is a custom smiley
855 * used in the first message in a MSN conversation: we need to create 854 * used in the first message in a MSN conversation: we need to create
856 * the conversation now, otherwise the custom smiley won't be shown. 855 * the conversation now, otherwise the custom smiley won't be shown.
857 * This happens because every GtkIMHtml has its own smiley tree: if 856 * This happens because every GtkIMHtml has its own smiley tree: if