New option --email sets user email address.
Showing
1 changed file
with
15 additions
and
4 deletions
... | @@ -84,6 +84,9 @@ static struct argp_option options[] = | ... | @@ -84,6 +84,9 @@ static struct argp_option options[] = |
84 | {"debug", 'd', "FLAGS", OPTION_ARG_OPTIONAL, | 84 | {"debug", 'd', "FLAGS", OPTION_ARG_OPTIONAL, |
85 | "Debug flags (defaults to \"" D_DEFAULT "\")", 0}, | 85 | "Debug flags (defaults to \"" D_DEFAULT "\")", 0}, |
86 | 86 | ||
87 | {"email", 'e', "ADDRESS", 0, | ||
88 | "Override user email address", 0}, | ||
89 | |||
87 | {0} | 90 | {0} |
88 | }; | 91 | }; |
89 | 92 | ||
... | @@ -102,6 +105,7 @@ static error_t | ... | @@ -102,6 +105,7 @@ static error_t |
102 | parser (int key, char *arg, struct argp_state *state) | 105 | parser (int key, char *arg, struct argp_state *state) |
103 | { | 106 | { |
104 | struct options *opts = state->input; | 107 | struct options *opts = state->input; |
108 | int rc; | ||
105 | 109 | ||
106 | switch (key) | 110 | switch (key) |
107 | { | 111 | { |
... | @@ -114,6 +118,12 @@ parser (int key, char *arg, struct argp_state *state) | ... | @@ -114,6 +118,12 @@ parser (int key, char *arg, struct argp_state *state) |
114 | opts->debug_level = MU_DEBUG_ERROR; | 118 | opts->debug_level = MU_DEBUG_ERROR; |
115 | break; | 119 | break; |
116 | 120 | ||
121 | case 'e': | ||
122 | rc = mu_set_user_email (arg); | ||
123 | if (rc) | ||
124 | argp_error (state, "invalid email: %s", mu_errstring (rc)); | ||
125 | break; | ||
126 | |||
117 | case 'n': | 127 | case 'n': |
118 | opts->sieve_debug |= MU_SIEVE_DRY_RUN; | 128 | opts->sieve_debug |= MU_SIEVE_DRY_RUN; |
119 | break; | 129 | break; |
... | @@ -271,8 +281,8 @@ main (int argc, char *argv[]) | ... | @@ -271,8 +281,8 @@ main (int argc, char *argv[]) |
271 | mu_error ("can't initialize sieve machine: %s", mu_errstring (rc)); | 281 | mu_error ("can't initialize sieve machine: %s", mu_errstring (rc)); |
272 | return 1; | 282 | return 1; |
273 | } | 283 | } |
274 | sieve_machine_set_debug (mach, sieve_debug_printer); | 284 | sieve_set_debug (mach, sieve_debug_printer); |
275 | sieve_machine_set_logger (mach, action_log); | 285 | sieve_set_logger (mach, action_log); |
276 | 286 | ||
277 | rc = sieve_compile (mach, opts.script); | 287 | rc = sieve_compile (mach, opts.script); |
278 | if (rc) | 288 | if (rc) |
... | @@ -300,7 +310,7 @@ main (int argc, char *argv[]) | ... | @@ -300,7 +310,7 @@ main (int argc, char *argv[]) |
300 | mu_error ("ticket get failed: %s\n", mu_errstring (rc)); | 310 | mu_error ("ticket get failed: %s\n", mu_errstring (rc)); |
301 | goto cleanup; | 311 | goto cleanup; |
302 | } | 312 | } |
303 | sieve_machine_set_ticket (mach, ticket); | 313 | sieve_set_ticket (mach, ticket); |
304 | } | 314 | } |
305 | 315 | ||
306 | /* Create a debug object, if needed. */ | 316 | /* Create a debug object, if needed. */ |
... | @@ -325,7 +335,7 @@ main (int argc, char *argv[]) | ... | @@ -325,7 +335,7 @@ main (int argc, char *argv[]) |
325 | } | 335 | } |
326 | } | 336 | } |
327 | 337 | ||
328 | sieve_machine_set_debug_level (mach, debug, opts.sieve_debug); | 338 | sieve_set_debug_level (mach, debug, opts.sieve_debug); |
329 | 339 | ||
330 | /* Create a mailer. */ | 340 | /* Create a mailer. */ |
331 | if (strcmp (opts.mailer, "none")) | 341 | if (strcmp (opts.mailer, "none")) |
... | @@ -342,6 +352,7 @@ main (int argc, char *argv[]) | ... | @@ -342,6 +352,7 @@ main (int argc, char *argv[]) |
342 | mu_errstring (rc)); | 352 | mu_errstring (rc)); |
343 | goto cleanup; | 353 | goto cleanup; |
344 | } | 354 | } |
355 | sieve_set_mailer (mach, mailer); | ||
345 | } | 356 | } |
346 | /* Create, give a ticket to, and open the mailbox. */ | 357 | /* Create, give a ticket to, and open the mailbox. */ |
347 | if ((rc = mailbox_create_default (&mbox, opts.mbox)) != 0) | 358 | if ((rc = mailbox_create_default (&mbox, opts.mbox)) != 0) | ... | ... |
-
Please register or sign in to post a comment