# HG changeset patch
# User Elliott Sales de Andrade <qulogic@pidgin.im>
# Date 1229296474 0
# Node ID c09a647fd538669b26c91c052a8aa58c99d0a483
# Parent  da1a76d4b7da3d8539a8f9eb5cf6dfa600dd537e
When parsing MSN message payload headers, check for folded lines. The only
important one right now is the boundary="..." part of the Content-Type for
multi-part messages.

diff -r da1a76d4b7da -r c09a647fd538 libpurple/protocols/msn/msg.c
--- a/libpurple/protocols/msn/msg.c	Sun Dec 14 23:11:27 2008 +0000
+++ b/libpurple/protocols/msn/msg.c	Sun Dec 14 23:14:34 2008 +0000
@@ -231,6 +231,25 @@
 	{
 		const char *key, *value;
 
+		/* If this line starts with whitespace, it's been folded from the
+		   previous line and won't have ':'. */
+		if ((**cur == ' ') || (**cur == '\t')) {
+			tokens = g_strsplit(g_strchug(*cur), "=\"", 2);
+			key = tokens[0];
+			value = tokens[1];
+
+			/* The only one I care about is 'boundary' (which is folded from
+			   the key 'Content-Type'), so only process that. */
+			if (!strcmp(key, "boundary")) {
+				char *end = strchr(value, '\"');
+				*end = '\0';
+				msn_message_set_attr(msg, key, value);
+			}
+
+			g_strfreev(tokens);
+			continue;
+		}
+
 		tokens = g_strsplit(*cur, ": ", 2);
 
 		key = tokens[0];