pidgin: 4db98c56: When parsing MSN message payload headers...

qulogic at pidgin.im qulogic at pidgin.im
Sun Dec 14 20:55:40 EST 2008


-----------------------------------------------------------------
Revision: 4db98c5641cee3ea4ae60f90d8a2147ea7a37bd9
Ancestor: f5de7408fa8d5aed024aaa8c74d7a2d692816b21
Author: qulogic at pidgin.im
Date: 2008-12-14T23:14:34
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4db98c5641cee3ea4ae60f90d8a2147ea7a37bd9

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

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msg.c	766882c4ab6fe5389fd2f575f9c9f6f2034cd8e6
+++ libpurple/protocols/msn/msg.c	28dde33e686030931faf6678dfa42e8bab1385ac
@@ -231,6 +231,25 @@ msn_message_parse_payload(MsnMessage *ms
 	{
 		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];


More information about the Commits mailing list