mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 23:51:59 +01:00
remove message files if it's a duplicate according to message-id
This commit is contained in:
parent
154780c4a7
commit
cbd986a29c
@ -416,7 +416,12 @@ int process_message(struct session_data *sdata, struct _state *state, struct __d
|
||||
|
||||
rc = store_meta_data(sdata, state, cfg);
|
||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: stored metadata, rc=%d", sdata->ttmpfile, rc);
|
||||
if(rc == ERR_EXISTS) return ERR_EXISTS;
|
||||
if(rc == ERR_EXISTS){
|
||||
|
||||
remove_stored_message_files(sdata, state, cfg);
|
||||
|
||||
return ERR_EXISTS;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg);
|
||||
|
||||
int process_message(struct session_data *sdata, struct _state *state, struct __data *data, struct __config *cfg);
|
||||
int store_file(struct session_data *sdata, char *filename, int startpos, int len, struct __config *cfg);
|
||||
int remove_stored_message_files(struct session_data *sdata, struct _state *state, struct __config *cfg);
|
||||
int store_attachments(struct session_data *sdata, struct _state *state, struct __config *cfg);
|
||||
int query_attachments(struct session_data *sdata, struct ptr_array *ptr_arr, struct __config *cfg);
|
||||
|
||||
|
25
src/store.c
25
src/store.c
@ -173,3 +173,28 @@ ENDE:
|
||||
}
|
||||
|
||||
|
||||
int remove_stored_message_files(struct session_data *sdata, struct _state *state, struct __config *cfg){
|
||||
int i;
|
||||
char s[SMALLBUFSIZE];
|
||||
|
||||
if(state->n_attachments > 0){
|
||||
|
||||
for(i=1; i<=state->n_attachments; i++){
|
||||
snprintf(s, sizeof(s)-1, "%s/%c%c/%c%c/%c%c/%s.a%d", cfg->queuedir, sdata->ttmpfile[RND_STR_LEN-6], sdata->ttmpfile[RND_STR_LEN-5], sdata->ttmpfile[RND_STR_LEN-4], sdata->ttmpfile[RND_STR_LEN-3], sdata->ttmpfile[RND_STR_LEN-2], sdata->ttmpfile[RND_STR_LEN-1], sdata->ttmpfile, i);
|
||||
|
||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: unlinking %s", sdata->ttmpfile, s);
|
||||
|
||||
unlink(s);
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(s, sizeof(s)-1, "%s/%c%c/%c%c/%c%c/%s.m", cfg->queuedir, sdata->ttmpfile[RND_STR_LEN-6], sdata->ttmpfile[RND_STR_LEN-5], sdata->ttmpfile[RND_STR_LEN-4], sdata->ttmpfile[RND_STR_LEN-3], sdata->ttmpfile[RND_STR_LEN-2], sdata->ttmpfile[RND_STR_LEN-1], sdata->ttmpfile);
|
||||
|
||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: unlinking %s", sdata->ttmpfile, s);
|
||||
|
||||
unlink(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user