diff --git a/src/misc.c b/src/misc.c index bf3f35e3..26b94579 100644 --- a/src/misc.c +++ b/src/misc.c @@ -231,13 +231,13 @@ int trimBuffer(char *s){ int n=0; char *p; - p = strrchr(s, '\n'); + p = strchr(s, '\n'); if(p){ *p = '\0'; n++; } - p = strrchr(s, '\r'); + p = strchr(s, '\r'); if(p){ *p = '\0'; n++; diff --git a/src/parser.c b/src/parser.c index 73e14746..c028e9e7 100644 --- a/src/parser.c +++ b/src/parser.c @@ -197,7 +197,14 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata sdata->restored_copy = 1; } - if(sdata->ms_journal == 0 && strncmp(buf, "X-MS-Journal-Report:", strlen("X-MS-Journal-Report:")) == 0){ + if(sdata->ms_journal == 0 && ( strncmp(buf, "X-MS-Journal-Report:", strlen("X-MS-Journal-Report:")) == 0 || strncmp(buf, "X-WM-Journal-Report: journal", strlen("X-WM-Journal-Report: journal")) == 0) ){ + + memset(state->b_to, 0, MAXBUFSIZE); + state->tolen = 0; + memset(state->b_to_domain, 0, SMALLBUFSIZE); + + clearhash(state->rcpt); + //if(sdata->import == 0){ sdata->ms_journal = 1; memset(state->message_id, 0, SMALLBUFSIZE); @@ -659,8 +666,6 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata } - /* remove all HTML tags */ - if(state->texthtml == 1 && state->message_state == MSG_BODY) markHTML(buf, state); if(state->message_state == MSG_BODY && state->qp == 1){ fixupSoftBreakInQuotedPritableLine(buf, state); // 2011.12.07 @@ -670,6 +675,10 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata /* I believe that we can live without this function call */ //decodeURL(buf); + /* remove all HTML tags */ + if(state->texthtml == 1 && state->message_state == MSG_BODY) markHTML(buf, state); + + if(state->texthtml == 1) decodeHTML(buf, state->utf8); /* encode the body if it's not utf-8 encoded */