Mercurial > pidgin.yaz
changeset 28418:afe6ce7cc64f
Send proper emoticon messages in MSN chats. Apparently, this never worked
at all even though I thought it did.
Fixes #10027.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 23 Aug 2009 01:58:16 +0000 |
parents | ea7e54c4d7fd |
children | 36c6601d650a |
files | ChangeLog libpurple/protocols/msn/msn.c |
diffstat | 2 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Aug 23 01:03:07 2009 +0000 +++ b/ChangeLog Sun Aug 23 01:58:16 2009 +0000 @@ -4,6 +4,7 @@ libpurple: * Fix --disable-avahi to actually disable it in configure, as opposed to just making the warning non-fatal. + * Sending custom smileys in MSN chats is now supported. XMPP: * Prompt the user before cancelling a presence subscription.
--- a/libpurple/protocols/msn/msn.c Sun Aug 23 01:03:07 2009 +0000 +++ b/libpurple/protocols/msn/msn.c Sun Aug 23 01:58:16 2009 +0000 @@ -1082,12 +1082,10 @@ strobj = msn_object_to_string(obj); if (current) - g_string_append_printf(current, "\t%s\t%s", - emoticon->smile, strobj); + g_string_append_printf(current, "\t%s\t%s", emoticon->smile, strobj); else { current = g_string_new(""); - g_string_printf(current,"%s\t%s", - emoticon->smile, strobj); + g_string_printf(current, "%s\t%s", emoticon->smile, strobj); } g_free(strobj); @@ -1718,14 +1716,19 @@ { PurpleAccount *account; MsnSession *session; + const char *username; MsnSwitchBoard *swboard; MsnMessage *msg; char *msgformat; char *msgtext; size_t msglen; + MsnEmoticon *smile; + GSList *smileys; + GString *emoticons = NULL; account = purple_connection_get_account(gc); session = gc->proto_data; + username = purple_account_get_username(account); swboard = msn_session_find_swboard_with_id(session, id); if (swboard == NULL) @@ -1749,6 +1752,20 @@ msg = msn_message_new_plain(msgtext); msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); + + smileys = msn_msg_grab_emoticons(msg->body, username); + while (smileys) { + smile = (MsnEmoticon *)smileys->data; + emoticons = msn_msg_emoticon_add(emoticons, smile); + msn_emoticon_destroy(smile); + smileys = g_slist_delete_link(smileys, smileys); + } + + if (emoticons) { + msn_send_emoticons(swboard, emoticons); + g_string_free(emoticons, TRUE); + } + msn_switchboard_send_msg(swboard, msg, FALSE); msn_message_destroy(msg);