]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lda: Added %e / %{from_envelope} variable to deliver_log_format.
authorTimo Sirainen <tss@iki.fi>
Wed, 18 Jan 2012 14:52:14 +0000 (16:52 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 18 Jan 2012 14:52:14 +0000 (16:52 +0200)
src/lib-lda/mail-deliver.c

index 01e7084a7eb2a47fcb626d307f26e4a2ead4e494..3765bf1421ede2d0dade72885df1ad4696f40709 100644 (file)
@@ -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;
 }