added an option to decide whether to archive messages without message-id header line

This commit is contained in:
SJ 2012-07-06 13:02:40 +02:00
parent 3a9b8a8ba0
commit 2d803e31d3
4 changed files with 13 additions and 2 deletions

View File

@ -52,6 +52,12 @@ workdir=/var/piler/tmp
piler_header_field=X-piler: piler already archived this email
; whether to archive an email not having a Message-ID header line (1)
; or not (0).
; If enabled then piler will assign piler_id as the message-id
archive_emails_not_having_message_id=0
; comma separated list of your domains. piler uses this information to determine
; the direction of the given email

View File

@ -59,6 +59,7 @@ struct _parse_rule {
struct _parse_rule config_parse_rules[] =
{
{ "archive_emails_not_having_message_id", "integer", (void*) int_parser, offsetof(struct __config, archive_emails_not_having_message_id), "0", sizeof(int)},
{ "backlog", "integer", (void*) int_parser, offsetof(struct __config, backlog), "20", sizeof(int)},
{ "clamd_addr", "string", (void*) string_parser, offsetof(struct __config, clamd_addr), "", MAXVAL-1},
{ "clamd_port", "integer", (void*) int_parser, offsetof(struct __config, clamd_port), "0", sizeof(int)},

View File

@ -62,6 +62,7 @@ struct __config {
int update_counters_to_memcached;
int memcached_to_db_interval;
int archive_emails_not_having_message_id;
};

View File

@ -123,7 +123,11 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi
}
if(state->message_id[0] == 0) snprintf(state->message_id, SMALLBUFSIZE-1, "null");
if(state->message_id[0] == 0){
if(cfg->archive_emails_not_having_message_id == 1)
snprintf(state->message_id, SMALLBUFSIZE-1, sdata->ttmpfile);
else snprintf(state->message_id, SMALLBUFSIZE-1, "null");
}
len = strlen(state->b_from);
if(state->b_from[len-1] == ' ') state->b_from[len-1] = '\0';
@ -131,7 +135,6 @@ void post_parse(struct session_data *sdata, struct _state *state, struct __confi
len = strlen(state->b_to);
if(state->b_to[len-1] == ' ') state->b_to[len-1] = '\0';
//syslog(LOG_PRIORITY, "%s: from=%s, to=%s, subj=%s, message-id=%s, reference=%s", sdata->ttmpfile, state->b_from, state->b_to, state->b_subject, state->message_id, state->reference);
}