dovecot-2.1-pigeonhole: lib-sieve: vacation extension: Fixed det...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Mon Nov 26 22:17:11 EET 2012
details: http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/b56711807edc
changeset: 1667:b56711807edc
user: Stephan Bosch <stephan at rename-it.nl>
date: Mon Nov 26 21:16:54 2012 +0100
description:
lib-sieve: vacation extension: Fixed determination of From: address for when sieve_vacation_dont_check_recipient is active.
diffstat:
src/lib-sieve/plugins/vacation/cmd-vacation.c | 76 ++++++++++++++------------
1 files changed, 41 insertions(+), 35 deletions(-)
diffs (105 lines):
diff -r 0dc8453e07c4 -r b56711807edc src/lib-sieve/plugins/vacation/cmd-vacation.c
--- a/src/lib-sieve/plugins/vacation/cmd-vacation.c Wed Oct 17 22:11:16 2012 +0200
+++ b/src/lib-sieve/plugins/vacation/cmd-vacation.c Mon Nov 26 21:16:54 2012 +0100
@@ -1031,7 +1031,7 @@
const char *recipient = sieve_message_get_final_recipient(aenv->msgctx);
const char *const *hdsp;
const char *const *headers;
- const char *reply_from = NULL;
+ const char *reply_from = NULL, *orig_recipient = NULL;
/* Is the recipient unset?
*/
@@ -1142,52 +1142,58 @@
return TRUE;
}
+ /* Fetch original recipient if necessary */
+ if ( config->use_original_recipient )
+ orig_recipient = sieve_message_get_orig_recipient(aenv->msgctx);
+
/* Is the original message directly addressed to the user or the addresses
* specified using the :addresses tag?
*/
- if ( !config->dont_check_recipient ) {
- const char *orig_recipient = NULL;
+ hdsp = _my_address_headers;
+ while ( *hdsp != NULL ) {
+ if ( mail_get_headers
+ (mail, *hdsp, &headers) >= 0 && headers[0] != NULL ) {
- if ( config->use_original_recipient )
- orig_recipient = sieve_message_get_orig_recipient(aenv->msgctx);
+ /* Final recipient directly listed in headers? */
+ if ( _contains_my_address(headers, recipient) ) {
+ reply_from = recipient;
+ break;
+ }
- hdsp = _my_address_headers;
- while ( *hdsp != NULL ) {
- if ( mail_get_headers
- (mail, *hdsp, &headers) >= 0 && headers[0] != NULL ) {
+ /* Original recipient directly listed in headers? */
+ if ( orig_recipient != NULL &&
+ _contains_my_address(headers, orig_recipient) ) {
+ reply_from = orig_recipient;
+ break;
+ }
- if ( _contains_my_address(headers, recipient) ) {
- reply_from = recipient;
- break;
+ /* User-provided :addresses listed in headers? */
+ if ( ctx->addresses != NULL ) {
+ bool found = FALSE;
+ const char * const *my_address = ctx->addresses;
+
+ while ( !found && *my_address != NULL ) {
+ if ( (found=_contains_my_address(headers, *my_address)) )
+ reply_from = *my_address;
+ my_address++;
}
- if ( orig_recipient != NULL && _contains_my_address(headers, orig_recipient) ) {
- reply_from = orig_recipient;
- break;
- }
+ if ( found ) break;
+ }
+ }
+ hdsp++;
+ }
- if ( ctx->addresses != NULL ) {
- bool found = FALSE;
- const char * const *my_address = ctx->addresses;
+ /* My address not found in the headers; we got an implicit delivery */
+ if ( *hdsp == NULL ) {
+ if ( config->dont_check_recipient ) {
+ /* Send reply from envelope recipient address */
+ reply_from = recipient;
- while ( !found && *my_address != NULL ) {
- if ( (found=_contains_my_address(headers, *my_address)) )
- reply_from = *my_address;
- my_address++;
- }
-
- if ( found ) break;
- }
- }
- hdsp++;
- }
-
-
- /* My address not found in the headers; we got an implicit delivery */
- if ( *hdsp == NULL ) {
+ } else {
const char *original_recipient = "";
- /* No, bail out */
+ /* Bail out */
if ( config->use_original_recipient ) {
original_recipient = t_strdup_printf("original-recipient=<%s>, ",
More information about the dovecot-cvs
mailing list