src: fix html parsing + added amazon journaling support

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2017-09-06 19:55:30 +02:00
parent 19c41a37fe
commit 631e8de191
2 changed files with 14 additions and 5 deletions

View File

@ -231,13 +231,13 @@ int trimBuffer(char *s){
int n=0; int n=0;
char *p; char *p;
p = strrchr(s, '\n'); p = strchr(s, '\n');
if(p){ if(p){
*p = '\0'; *p = '\0';
n++; n++;
} }
p = strrchr(s, '\r'); p = strchr(s, '\r');
if(p){ if(p){
*p = '\0'; *p = '\0';
n++; n++;

View File

@ -197,7 +197,14 @@ int parse_line(char *buf, struct parser_state *state, struct session_data *sdata
sdata->restored_copy = 1; 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){ //if(sdata->import == 0){
sdata->ms_journal = 1; sdata->ms_journal = 1;
memset(state->message_id, 0, SMALLBUFSIZE); 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){ if(state->message_state == MSG_BODY && state->qp == 1){
fixupSoftBreakInQuotedPritableLine(buf, state); // 2011.12.07 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 */ /* I believe that we can live without this function call */
//decodeURL(buf); //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); if(state->texthtml == 1) decodeHTML(buf, state->utf8);
/* encode the body if it's not utf-8 encoded */ /* encode the body if it's not utf-8 encoded */