display the stored id when a duplicate is found

This commit is contained in:
SJ 2013-11-12 14:51:31 +01:00
parent c31355b343
commit 7cd329f10c
6 changed files with 10 additions and 8 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.25-master-branch" #define VERSION "0.1.25-master-branch"
#define BUILD 849 #define BUILD 850
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -187,6 +187,7 @@ struct session_data {
char acceptbuf[SMALLBUFSIZE]; char acceptbuf[SMALLBUFSIZE];
char attachments[SMALLBUFSIZE]; char attachments[SMALLBUFSIZE];
char internal_sender, internal_recipient, external_recipient; char internal_sender, internal_recipient, external_recipient;
uint64 duplicate_id;
short int customer_id; short int customer_id;
int direction; int direction;
int tls; int tls;

View File

@ -119,7 +119,7 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
counters.c_duplicate = 1; counters.c_duplicate = 1;
update_counters(sdata, data, &counters, cfg); update_counters(sdata, data, &counters, cfg);
if(data->quiet == 0)printf("duplicate: %s (id: %s)\n", filename, sdata->ttmpfile); if(data->quiet == 0) printf("duplicate: %s (duplicate id: %llu)\n", filename, sdata->duplicate_id);
break; break;
default: default:

View File

@ -247,18 +247,17 @@ void remove_stripped_attachments(struct _state *state){
int process_message(struct session_data *sdata, struct _state *state, struct __data *data, struct __config *cfg){ int process_message(struct session_data *sdata, struct _state *state, struct __data *data, struct __config *cfg){
int rc; int rc;
uint64 id=0;
/* discard if existing message_id */ /* discard if existing message_id */
id = get_metaid_by_messageid(sdata, data, state->message_id, cfg); sdata->duplicate_id = get_metaid_by_messageid(sdata, data, state->message_id, cfg);
if(id > 0){ if(sdata->duplicate_id > 0){
remove_stripped_attachments(state); remove_stripped_attachments(state);
if(strlen(state->b_journal_to) > 0){ if(strlen(state->b_journal_to) > 0){
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: trying to add journal rcpt (%s) to id=%llu for message-id: '%s'", sdata->ttmpfile, state->b_journal_to, id, state->message_id); if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: trying to add journal rcpt (%s) to id=%llu for message-id: '%s'", sdata->ttmpfile, state->b_journal_to, sdata->duplicate_id, state->message_id);
store_recipients(sdata, data, state->b_journal_to, id, 0, cfg); store_recipients(sdata, data, state->b_journal_to, sdata->duplicate_id, 0, cfg);
} }
return ERR_EXISTS; return ERR_EXISTS;

View File

@ -446,6 +446,8 @@ void init_session_data(struct session_data *sdata, struct __config *cfg){
memset(sdata->fromemail, 0, SMALLBUFSIZE); memset(sdata->fromemail, 0, SMALLBUFSIZE);
sdata->duplicate_id = 0;
sdata->restored_copy = 0; sdata->restored_copy = 0;
sdata->internal_sender = sdata->internal_recipient = sdata->external_recipient = 0; sdata->internal_sender = sdata->internal_recipient = sdata->external_recipient = 0;

View File

@ -255,7 +255,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
counters.c_rcvd++; counters.c_rcvd++;
if(inj == ERR_EXISTS){ if(inj == ERR_EXISTS){
syslog(LOG_PRIORITY, "%s: discarding: duplicate message", sdata.ttmpfile); syslog(LOG_PRIORITY, "%s: discarding: duplicate message, id: %llu", sdata.ttmpfile, sdata.duplicate_id);
counters.c_duplicate++; counters.c_duplicate++;
} }