Mercurial > pidgin
diff libpurple/protocols/msn/msg.c @ 20517:2ebde8bd0e58
explicit merge of '7ca52e5d60c8f4d7842faad73378b57df9db9007'
and 'b1148e355b30c726e5fdcc11dc57ddb0cc8736ea'
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Sun, 16 Sep 2007 18:06:22 +0000 |
| parents | 97559afd70e4 723b5a2f91ce |
| children | 1d9d5de48b9e |
line wrap: on
line diff
--- a/libpurple/protocols/msn/msg.c Tue Sep 11 13:48:19 2007 +0000 +++ b/libpurple/protocols/msn/msg.c Sun Sep 16 18:06:22 2007 +0000 @@ -126,7 +126,7 @@ msn_message_set_charset(msg, "UTF-8"); msn_message_set_flag(msg, 'A'); msn_message_set_attr(msg, "X-MMS-IM-Format", - "FN=MS%20Sans%20Serif; EF=; CO=0; PF=0"); + "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)); @@ -206,7 +206,8 @@ void msn_message_parse_payload(MsnMessage *msg, - const char *payload, size_t payload_len) + const char *payload, size_t payload_len, + const char *line_dem,const char *body_dem) { char *tmp_base, *tmp; const char *content_type; @@ -214,12 +215,11 @@ char **elems, **cur, **tokens; g_return_if_fail(payload != NULL); - tmp_base = tmp = g_malloc0(payload_len + 1); memcpy(tmp_base, payload, payload_len); /* Parse the attributes. */ - end = strstr(tmp, "\r\n\r\n"); + end = strstr(tmp, body_dem); /* TODO? some clients use \r delimiters instead of \r\n, the official client * doesn't send such messages, but does handle receiving them. We'll just * avoid crashing for now */ @@ -229,7 +229,7 @@ } *end = '\0'; - elems = g_strsplit(tmp, "\r\n", 0); + elems = g_strsplit(tmp, line_dem, 0); for (cur = elems; *cur != NULL; cur++) { @@ -240,6 +240,7 @@ key = tokens[0]; value = tokens[1]; + /*if not MIME content ,then return*/ if (!strcmp(key, "MIME-Version")) { g_strfreev(tokens); @@ -274,7 +275,7 @@ g_strfreev(elems); /* Proceed to the end of the "\r\n\r\n" */ - tmp = end + 4; + tmp = end + strlen(body_dem); /* Now we *should* be at the body. */ content_type = msn_message_get_content_type(msg); @@ -480,6 +481,7 @@ { memcpy(n, body, body_len); n += body_len; + *n = '\0'; } }
