comparison src/protocols/msn/slp.c @ 10526:55e7d72fc09a

[gaim-migrate @ 11843] maquina writes: This patch implements a custom smiley API, and it also implements custom smileys for the msn protocol. As it stands, it is not able to cache custom smileys, and is not able to redefine a custom smiley without opening a new conversation. I modified it quite a bit, and didn't test it at all, so it probably doesn't work anymore. I'm not quite done with it yet either. Also, this is just receiving custom smileys. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Tue, 18 Jan 2005 18:31:32 +0000
parents bec9130b24d2
children 507c680b573e
comparison
equal deleted inserted replaced
10525:ddea15f4cbc2 10526:55e7d72fc09a
737 737
738 void 738 void
739 got_emoticon(MsnSlpCall *slpcall, 739 got_emoticon(MsnSlpCall *slpcall,
740 const char *data, long long size) 740 const char *data, long long size)
741 { 741 {
742
743 GaimConversation *conv;
744 GaimConnection *gc;
745 const char *who;
746
747 gc = slpcall->slplink->session->account->gc;
748 who = slpcall->slplink->remote_user;
749
750 conv = gaim_find_conversation_with_account(GAIM_CONV_ANY, who, gc->account);
751
752 /* FIXME: it would be better if we wrote the data as we received it
753 instead of all at once, calling write multiple times and
754 close once at the very end
755 */
756 gaim_conv_custom_smiley_write(conv, slpcall->data_info, data, size);
757 gaim_conv_custom_smiley_close(conv, slpcall->data_info );
758
742 gaim_debug_info("msn", "Got smiley: %s\n", slpcall->data_info); 759 gaim_debug_info("msn", "Got smiley: %s\n", slpcall->data_info);
743
744 #if 0
745 serv_got_smiley(slpcall->slplink->session->account->gc,
746 slpcall->slplink->remote_user, slpcall->data_info, data, size);
747 #endif
748
749 #if 0
750 GaimConversation *conv;
751 GaimConnection *gc = slpsession->swboard->servconn->session->account->gc;
752 serv_got_smiley(gc, info, data, size);
753 #endif
754 } 760 }
755 761
756 void 762 void
757 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg) 763 msn_emoticon_msg(MsnCmdProc *cmdproc, MsnMessage *msg)
758 { 764 {
761 MsnObject *obj; 767 MsnObject *obj;
762 char **tokens; 768 char **tokens;
763 char *smile; 769 char *smile;
764 const char *who; 770 const char *who;
765 771
772 GaimConversation *conversation;
773 GaimConnection *gc;
774
766 session = cmdproc->servconn->session; 775 session = cmdproc->servconn->session;
767 776
768 tokens = g_strsplit(msg->body, "\t", 2); 777 tokens = g_strsplit(msg->body, "\t", 2);
769 778
770 smile = tokens[0]; 779 smile = tokens[0];
772 781
773 who = msn_object_get_creator(obj); 782 who = msn_object_get_creator(obj);
774 783
775 slplink = msn_session_get_slplink(session, who); 784 slplink = msn_session_get_slplink(session, who);
776 785
777 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj); 786 gc = slplink->session->account->gc;
787
788 conversation = gaim_find_conversation_with_account(GAIM_CONV_ANY, who, gc->account);
789
790 if (gaim_conv_custom_smiley_add(conversation, smile, "sha1" /* i think it's a sha1 checksum? */, "base64 encoded checksum here, shx should fix this!")) {
791 msn_slplink_request_object(slplink, smile, got_emoticon, NULL, obj);
792 }
778 793
779 g_strfreev(tokens); 794 g_strfreev(tokens);
780 } 795 }
781 796
782 static gboolean 797 static gboolean