added tweak option to manually imported emails, too

This commit is contained in:
SJ 2013-02-22 15:35:37 +01:00
parent b6b1a203d0
commit 28a85ef44c
4 changed files with 9 additions and 5 deletions

View File

@ -13,7 +13,7 @@
#define VERSION "0.1.23-master-branch"
#define BUILD 769
#define BUILD 770
#define HOSTID "mailarchiver"

View File

@ -335,8 +335,8 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
else if(strncasecmp(buf, "References:", 11) == 0) state->message_state = MSG_REFERENCES;
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, "Date:", strlen("Date:")) == 0 && sdata->sent == 0) sdata->sent = parse_date_header(buf, cfg);
else if(strncasecmp(buf, "Delivery-date:", strlen("Delivery-date:")) == 0 && sdata->delivered == 0) sdata->delivered = parse_date_header(buf, cfg);
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;

View File

@ -14,7 +14,7 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi
int parse_line(char *buf, struct _state *state, struct session_data *sdata, int take_into_pieces, char *writebuffer, int writebuffersize, char *abuffer, int abuffersize, struct __data *data, struct __config *cfg);
void init_state(struct _state *state);
unsigned long parse_date_header(char *s);
unsigned long parse_date_header(char *s, struct __config *cfg);
int isHexNumber(char *p);
int extract_boundary(char *p, struct _state *state);
void fixupEncodedHeaderLine(char *buf);

View File

@ -100,7 +100,7 @@ void init_state(struct _state *state){
}
unsigned long parse_date_header(char *datestr){
unsigned long parse_date_header(char *datestr, struct __config *cfg){
int n=0;
char *p, *q, *r, s[SMALLBUFSIZE];
unsigned long ts=0;
@ -173,6 +173,10 @@ unsigned long parse_date_header(char *datestr){
tm.tm_isdst = -1;
ts = mktime(&tm);
#ifdef HAVE_TWEAK_SENT_TIME
if(ts > 631148400) ts += cfg->tweak_sent_time_offset;
#endif
return ts;
}