diff libpurple/protocols/msn/msg.c @ 27896:d515f6c5e6f2

fix for msn file transfer breakage.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 07 Oct 2008 03:13:59 +0000
parents acef4202e147
children 7cda79469830
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
 	{