mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 07:10:12 +01:00
parse the Delivery-date: header field if the Date: field is missing
This commit is contained in:
parent
47de67e4bc
commit
0ded5892db
@ -13,7 +13,7 @@
|
||||
|
||||
#define VERSION "0.1.22"
|
||||
|
||||
#define BUILD 734
|
||||
#define BUILD 735
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -188,7 +188,7 @@ struct session_data {
|
||||
float __acquire, __parsed, __av, __store, __compress, __encrypt;
|
||||
char bodydigest[2*DIGEST_LENGTH+1];
|
||||
char digest[2*DIGEST_LENGTH+1];
|
||||
time_t now, sent, retained;
|
||||
time_t now, sent, delivered, retained;
|
||||
char ms_journal, ms_journal_dropped;
|
||||
int journal_envelope_length, journal_bottom_length;
|
||||
#ifdef NEED_MYSQL
|
||||
|
@ -67,10 +67,13 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
|
||||
|
||||
|
||||
sdata->sent = 0;
|
||||
sdata->delivered = 0;
|
||||
|
||||
state = parse_message(sdata, 1, cfg);
|
||||
post_parse(sdata, &state, cfg);
|
||||
|
||||
if(sdata->sent <= 0 && sdata->delivered > 0) sdata->sent = sdata->delivered;
|
||||
|
||||
if(sdata->sent > sdata->now) sdata->sent = sdata->now;
|
||||
if(sdata->sent == -1) sdata->sent = 0;
|
||||
|
||||
|
@ -504,7 +504,7 @@ void init_session_data(struct session_data *sdata){
|
||||
for(i=0; i<MAX_RCPT_TO; i++) memset(sdata->rcptto[i], 0, SMALLBUFSIZE);
|
||||
|
||||
time(&(sdata->now));
|
||||
sdata->sent = sdata->retained = sdata->now;
|
||||
sdata->sent = sdata->delivered = sdata->retained = sdata->now;
|
||||
}
|
||||
|
||||
|
||||
|
@ -347,6 +347,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
||||
else if(strncasecmp(buf, "Subject:", strlen("Subject:")) == 0) state->message_state = MSG_SUBJECT;
|
||||
else if(strncasecmp(buf, "Recipient:", strlen("Recipient:")) == 0) state->message_state = MSG_RECIPIENT;
|
||||
else if(strncasecmp(buf, "Date:", strlen("Date:")) == 0 && sdata->sent == 0) sdata->sent = parse_date_header(buf);
|
||||
else if(strncasecmp(buf, "Delivery-date:", strlen("Delivery-date:")) == 0 && sdata->delivered == 0) sdata->delivered = parse_date_header(buf);
|
||||
else if(strncasecmp(buf, "Received:", strlen("Received:")) == 0) state->message_state = MSG_RECEIVED;
|
||||
else if(cfg->extra_to_field[0] != '\0' && strncasecmp(buf, cfg->extra_to_field, strlen(cfg->extra_to_field)) == 0) state->message_state = MSG_TO;
|
||||
|
||||
|
@ -63,6 +63,7 @@ int main(int argc, char **argv){
|
||||
init_session_data(&sdata);
|
||||
|
||||
sdata.sent = 0;
|
||||
sdata.delivered = 0;
|
||||
sdata.tot_len = st.st_size;
|
||||
|
||||
snprintf(sdata.ttmpfile, SMALLBUFSIZE-1, "%s", argv[1]);
|
||||
@ -79,7 +80,7 @@ int main(int argc, char **argv){
|
||||
printf("subject: *%s*\n", state.b_subject);
|
||||
printf("body: *%s*\n", state.b_body);
|
||||
|
||||
printf("sent: %ld\n", sdata.sent);
|
||||
printf("sent: %ld, delivered-date: %ld\n", sdata.sent, sdata.delivered);
|
||||
|
||||
make_digests(&sdata, &cfg);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user