pidgin: e8d6fba4: Send proper emoticon messages in MSN cha...

qulogic at pidgin.im qulogic at pidgin.im
Sat Aug 22 23:35:42 EDT 2009


-----------------------------------------------------------------
Revision: e8d6fba406f02956d2f340bbc7b4d60502e954cc
Ancestor: fd7fe6317b7006143473cb438061b45983e896d6
Author: qulogic at pidgin.im
Date: 2009-08-23T01:58:16
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e8d6fba406f02956d2f340bbc7b4d60502e954cc

Modified files:
        ChangeLog libpurple/protocols/msn/msn.c

ChangeLog: 

Send proper emoticon messages in MSN chats. Apparently, this never worked
at all even though I thought it did.

Fixes #10027.

-------------- next part --------------
============================================================
--- ChangeLog	2376c6f8c1093a035f1f73b5b6670b122aeac977
+++ ChangeLog	fe0d40e1679b88b4f9445f9df86d047cd76e9171
@@ -4,6 +4,7 @@ version 2.6.2 (??/??/2009):
 	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.
============================================================
--- libpurple/protocols/msn/msn.c	433afd6e5a563a823dc61e85deeec91cd89f27bd
+++ libpurple/protocols/msn/msn.c	117827b9904ce7ae58d5c8e71fd6c2e50e4947e6
@@ -1082,12 +1082,10 @@ msn_msg_emoticon_add(GString *current, M
 	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 @@ msn_chat_send(PurpleConnection *gc, int 
 {
 	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 @@ msn_chat_send(PurpleConnection *gc, int 
 
 	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);
 


More information about the Commits mailing list