From: Timo Sirainen Date: Wed, 18 Jan 2012 14:52:14 +0000 (+0200) Subject: lib-lda: Added %e / %{from_envelope} variable to deliver_log_format. X-Git-Tag: 2.1.rc4~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd42aa358abc9fbd8c25b7625cc2a1dc3ecbcffd;p=thirdparty%2Fdovecot%2Fcore.git lib-lda: Added %e / %{from_envelope} variable to deliver_log_format. --- diff --git a/src/lib-lda/mail-deliver.c b/src/lib-lda/mail-deliver.c index 01e7084a7e..3765bf1421 100644 --- a/src/lib-lda/mail-deliver.c +++ b/src/lib-lda/mail-deliver.c @@ -46,11 +46,13 @@ mail_deliver_get_log_var_expand_table(struct mail *mail, const char *message) { 'm', NULL, "msgid" }, { 's', NULL, "subject" }, { 'f', NULL, "from" }, + { 'e', NULL, "from_envelope" }, { 'p', NULL, "size" }, { 'w', NULL, "vsize" }, { '\0', NULL, NULL } }; struct var_expand_table *tab; + const char *str; uoff_t size; tab = t_malloc(sizeof(static_tab)); @@ -65,10 +67,14 @@ mail_deliver_get_log_var_expand_table(struct mail *mail, const char *message) tab[2].value = str_sanitize(tab[2].value, 80); tab[3].value = str_sanitize(mail_deliver_get_address(mail, "From"), 80); + if (mail_get_special(mail, MAIL_FETCH_FROM_ENVELOPE, &str) < 0) + str = ""; + tab[4].value = str_sanitize(str, 80); + if (mail_get_physical_size(mail, &size) == 0) - tab[4].value = dec2str(size); - if (mail_get_virtual_size(mail, &size) == 0) tab[5].value = dec2str(size); + if (mail_get_virtual_size(mail, &size) == 0) + tab[6].value = dec2str(size); return tab; }