changeset 27896:d515f6c5e6f2

fix for msn file transfer breakage.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 07 Oct 2008 03:13:59 +0000
parents e626fb0f2aab
children 7cda79469830
files libpurple/protocols/msn/msg.c libpurple/protocols/msn/msn.c
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c	Sun Oct 05 14:57:18 2008 +0000
+++ b/libpurple/protocols/msn/msg.c	Tue Oct 07 03:13:59 2008 +0000
@@ -111,7 +111,8 @@
 msn_message_new_plain(const char *message)
 {
 	MsnMessage *msg;
-	char *message_cr;
+	char *message_cr, *message_cr2;
+	gsize len;
 
 	msg = msn_message_new(MSN_MSG_TEXT);
 	msn_message_set_attr(msg, "User-Agent", PACKAGE_NAME "/" VERSION);
@@ -122,8 +123,10 @@
 						 "FN=MS%20Sans%20Serif; EF=; CO=0; CS=86;PF=0");
 
 	message_cr = purple_str_add_cr(message);
-	msn_message_set_bin_data(msg, message_cr, strlen(message_cr));
+	message_cr2 = botch_utf((gchar *)message_cr, -1, &len);
+	msn_message_set_bin_data(msg, message_cr2, len);
 	g_free(message_cr);
+	g_free(message_cr2);
 
 	return msg;
 }
@@ -522,7 +525,9 @@
 
 	if (data != NULL && len > 0)
 	{
-		msg->body = botch_utf((gchar *)data, len, &msg->body_len); /* yaz */
+		msg->body = g_malloc0(len + 1);
+		memcpy(msg->body, data, len);
+		msg->body_len = len;
 	}
 	else
 	{
--- a/libpurple/protocols/msn/msn.c	Sun Oct 05 14:57:18 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Tue Oct 07 03:13:59 2008 +0000
@@ -1082,13 +1082,18 @@
 msn_send_emoticons(MsnSwitchBoard *swboard, GString *body)
 {
 	MsnMessage *msg;
+	gchar *tmp;
+	gsize len;
 
 	g_return_if_fail(body != NULL);
 
 	msg = msn_message_new(MSN_MSG_SLP);
 	msn_message_set_content_type(msg, "text/x-mms-emoticon");
 	msn_message_set_flag(msg, 'N');
-	msn_message_set_bin_data(msg, body->str, body->len);
+
+	tmp = botch_utf(body->str, -1, &len);
+	msn_message_set_bin_data(msg, tmp, len);
+	g_free(tmp);
 
 	msn_switchboard_send_msg(swboard, msg, TRUE);
 	msn_message_destroy(msg);