diff src/protocols/msn/slp.c @ 10047:9b82412d3e52

[gaim-migrate @ 11008] Make MSN FT work on BE machines? See http://sourceforge.net/tracker/index.php?func=detail&aid=976472&group_id=235&atid=300235 Thanks to Jean-Francois Roy and Evan Schoenberg committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 19 Sep 2004 19:00:16 +0000
parents 68561f39acdc
children cf3454eadc22
line wrap: on
line diff
--- a/src/protocols/msn/slp.c	Sun Sep 19 18:41:45 2004 +0000
+++ b/src/protocols/msn/slp.c	Sun Sep 19 19:00:16 2004 +0000
@@ -235,6 +235,8 @@
 	msn_slplink_queue_slpmsg(slplink, slpmsg);
 }
 
+#define MAX_FILE_NAME_LEN 0x226
+
 static void
 got_sessionreq(MsnSlpCall *slpcall, const char *branch,
 			   const char *euf_guid, const char *context)
@@ -318,6 +320,7 @@
 		gsize bin_len;
 		guint32 file_size;
 		char *file_name;
+		gunichar2 *uni_name;
 
 		account = slpcall->slplink->session->account;
 
@@ -331,6 +334,13 @@
 
 		gaim_base64_decode(context, &bin, &bin_len);
 		file_size = GUINT32_FROM_LE(*((gsize *)bin + 2));
+		
+		uni_name = (gunichar2 *)(bin + 20);
+		while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) {
+			*uni_name = GUINT16_FROM_LE(*uni_name);
+			uni_name++;
+		}
+		
 		file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1,
 									NULL, NULL, NULL);