Mercurial > pidgin
comparison libpurple/protocols/msn/msn.c @ 28068: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 |
comparison
equal
deleted
inserted
replaced
28067:ea7e54c4d7fd | 28068:afe6ce7cc64f |
---|---|
1080 return current; | 1080 return current; |
1081 | 1081 |
1082 strobj = msn_object_to_string(obj); | 1082 strobj = msn_object_to_string(obj); |
1083 | 1083 |
1084 if (current) | 1084 if (current) |
1085 g_string_append_printf(current, "\t%s\t%s", | 1085 g_string_append_printf(current, "\t%s\t%s", emoticon->smile, strobj); |
1086 emoticon->smile, strobj); | |
1087 else { | 1086 else { |
1088 current = g_string_new(""); | 1087 current = g_string_new(""); |
1089 g_string_printf(current,"%s\t%s", | 1088 g_string_printf(current, "%s\t%s", emoticon->smile, strobj); |
1090 emoticon->smile, strobj); | |
1091 } | 1089 } |
1092 | 1090 |
1093 g_free(strobj); | 1091 g_free(strobj); |
1094 | 1092 |
1095 return current; | 1093 return current; |
1716 static int | 1714 static int |
1717 msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) | 1715 msn_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags) |
1718 { | 1716 { |
1719 PurpleAccount *account; | 1717 PurpleAccount *account; |
1720 MsnSession *session; | 1718 MsnSession *session; |
1719 const char *username; | |
1721 MsnSwitchBoard *swboard; | 1720 MsnSwitchBoard *swboard; |
1722 MsnMessage *msg; | 1721 MsnMessage *msg; |
1723 char *msgformat; | 1722 char *msgformat; |
1724 char *msgtext; | 1723 char *msgtext; |
1725 size_t msglen; | 1724 size_t msglen; |
1725 MsnEmoticon *smile; | |
1726 GSList *smileys; | |
1727 GString *emoticons = NULL; | |
1726 | 1728 |
1727 account = purple_connection_get_account(gc); | 1729 account = purple_connection_get_account(gc); |
1728 session = gc->proto_data; | 1730 session = gc->proto_data; |
1731 username = purple_account_get_username(account); | |
1729 swboard = msn_session_find_swboard_with_id(session, id); | 1732 swboard = msn_session_find_swboard_with_id(session, id); |
1730 | 1733 |
1731 if (swboard == NULL) | 1734 if (swboard == NULL) |
1732 return -EINVAL; | 1735 return -EINVAL; |
1733 | 1736 |
1747 return -E2BIG; | 1750 return -E2BIG; |
1748 } | 1751 } |
1749 | 1752 |
1750 msg = msn_message_new_plain(msgtext); | 1753 msg = msn_message_new_plain(msgtext); |
1751 msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); | 1754 msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat); |
1755 | |
1756 smileys = msn_msg_grab_emoticons(msg->body, username); | |
1757 while (smileys) { | |
1758 smile = (MsnEmoticon *)smileys->data; | |
1759 emoticons = msn_msg_emoticon_add(emoticons, smile); | |
1760 msn_emoticon_destroy(smile); | |
1761 smileys = g_slist_delete_link(smileys, smileys); | |
1762 } | |
1763 | |
1764 if (emoticons) { | |
1765 msn_send_emoticons(swboard, emoticons); | |
1766 g_string_free(emoticons, TRUE); | |
1767 } | |
1768 | |
1752 msn_switchboard_send_msg(swboard, msg, FALSE); | 1769 msn_switchboard_send_msg(swboard, msg, FALSE); |
1753 msn_message_destroy(msg); | 1770 msn_message_destroy(msg); |
1754 | 1771 |
1755 g_free(msgformat); | 1772 g_free(msgformat); |
1756 g_free(msgtext); | 1773 g_free(msgtext); |