extra recipient for piler

This commit is contained in:
SJ 2014-06-04 22:20:10 +02:00
parent f6a39fcd1d
commit ea5513105a
5 changed files with 32 additions and 8 deletions

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.25-rc2"
#define BUILD 873
#define BUILD 874
#define HOSTID "mailarchiver"

View File

@ -260,6 +260,7 @@ struct memcached_server {
struct import {
char *extra_recipient;
int status;
int total_messages;
int processed_messages;

View File

@ -32,6 +32,16 @@ struct _state parse_message(struct session_data *sdata, int take_into_pieces, st
}
if(sdata->import == 1 && data->import->extra_recipient){
len = strlen(data->import->extra_recipient);
memcpy(&(state.b_to[state.tolen]), data->import->extra_recipient, len);
state.tolen += len;
memcpy(&(state.b_to[state.tolen]), " ", 1);
state.tolen++;
strtolower(state.b_to);
}
if(sdata->num_of_rcpt_to > 0){
for(i=0; i<sdata->num_of_rcpt_to; i++){
extractEmail(sdata->rcptto[i], puf);

View File

@ -486,6 +486,7 @@ int main(int argc, char **argv){
import.import_job_id = import.total_messages = import.processed_messages = 0;
import.started = import.updated = import.finished = import.remove_after_import = 0;
import.extra_recipient = NULL;
data.import = &import;
@ -511,20 +512,21 @@ int main(int argc, char **argv){
{"skiplist", required_argument, 0, 'x' },
{"folder", required_argument, 0, 'F' },
{"folder_imap", required_argument, 0, 'f' },
{"quiet", required_argument, 0, 'q' },
{"add-recipient",required_argument, 0, 'a' },
{"quiet", no_argument, 0, 'q' },
{"recursive", required_argument, 0, 'R' },
{"remove-after-import", required_argument, 0, 'r' },
{"gui-import", required_argument, 0, 'G' },
{"dry-run", required_argument, 0, 'D' },
{"remove-after-import",no_argument, 0, 'r' },
{"gui-import", no_argument, 0, 'G' },
{"dry-run", no_argument, 0, 'D' },
{"help", no_argument, 0, 'h' },
{0,0,0,0}
};
int option_index = 0;
c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:GDRrqh?", long_options, &option_index);
c = getopt_long(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:GDRrqh?", long_options, &option_index);
#else
c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:GDRrqh?");
c = getopt(argc, argv, "c:m:M:e:d:i:K:u:p:P:x:F:f:a:GDRrqh?");
#endif
if(c == -1) break;
@ -597,6 +599,10 @@ int main(int argc, char **argv){
data.import->remove_after_import = 1;
break;
case 'a' :
data.import->extra_recipient = optarg;
break;
case 'G' :
import_from_gui = 1;
break;

View File

@ -22,12 +22,13 @@ int main(int argc, char **argv){
struct _state state;
struct __config cfg;
struct __data data;
struct import import;
char *rule;
srand(getpid());
if(argc < 2){
fprintf(stderr, "usage: %s <message>\n", argv[0]);
fprintf(stderr, "usage: %s <message> [<extra recipient>]\n", argv[0]);
exit(1);
}
@ -47,6 +48,12 @@ int main(int argc, char **argv){
printf("build: %d\n", get_build());
import.extra_recipient = NULL;
if(argc > 2) import.extra_recipient = argv[2];
data.import = &import;
data.folder = 0;
data.recursive_folder_names = 0;