summaryrefslogtreecommitdiffabout
path: root/kmicromail/libetpan/mime/mailmime_decode.c
Side-by-side diff
Diffstat (limited to 'kmicromail/libetpan/mime/mailmime_decode.c') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libetpan/mime/mailmime_decode.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/kmicromail/libetpan/mime/mailmime_decode.c b/kmicromail/libetpan/mime/mailmime_decode.c
index dbaeb68..b2ab0f7 100644
--- a/kmicromail/libetpan/mime/mailmime_decode.c
+++ b/kmicromail/libetpan/mime/mailmime_decode.c
@@ -114,14 +114,15 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode,
goto err;
}
first = TRUE;
type = TYPE_ERROR; /* XXX - removes a gcc warning */
-
- while (1) {
+ // LUTZ add
+ int appendNewLine = FALSE;
+ while (1) { //while
r = mailmime_encoded_word_parse(message, length, &cur_token, &word);
if (r == MAILIMF_NO_ERROR) {
if (!first) {
if (type != TYPE_ENCODED_WORD) {
if (mmap_string_append_c(gphrase, ' ') == NULL) {
@@ -196,26 +197,40 @@ int mailmime_encoded_phrase_parse(const char * default_fromcode,
case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET:
case MAIL_CHARCONV_ERROR_CONV:
free(raw_word);
res = MAILIMF_ERROR_PARSE;
goto free;
}
-
+ // LUTZ add
+ if ( appendNewLine ) {
+ appendNewLine = FALSE;
+ if (mmap_string_append(gphrase, "\n") == NULL) {
+ free(wordutf8);
+ free(raw_word);
+ res = MAILIMF_ERROR_MEMORY;
+ goto free;
+ }
+ }
+ //fprintf(stderr,"append *%s* \n",wordutf8 );
if (mmap_string_append(gphrase, wordutf8) == NULL) {
free(wordutf8);
free(raw_word);
res = MAILIMF_ERROR_MEMORY;
goto free;
}
// LUTZ fix
free(wordutf8);
free(raw_word);
first = FALSE;
}
else if (r == MAILIMF_ERROR_PARSE) {
+ // LUTZ add
+ if ( cur_token >= length )
break;
+ ++cur_token;
+ appendNewLine = TRUE;
}
else {
res = r;
goto free;
}
}