]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
deliver_log_format: Added support for size and vsize
authorTimo Sirainen <tss@iki.fi>
Wed, 21 Apr 2010 16:58:10 +0000 (19:58 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 21 Apr 2010 16:58:10 +0000 (19:58 +0300)
--HG--
branch : HEAD

doc/example-config/conf.d/10-logging.conf
src/lib-lda/mail-deliver.c

index 75505ffa4b61b11cf9fc60f8003d22cf18dadd68..06457c9d7a020b8fd9a6de9fcc5e4ecea80c2c30 100644 (file)
@@ -80,4 +80,6 @@ plugin {
 #  %m - Message-ID
 #  %s - Subject
 #  %f - From address
+#  %p - Physical size
+#  %w - Virtual size
 #deliver_log_format = msgid=%m: %$
index c6b9a6109d1232b8b14303c4f3db0cce200d582c..f3c15687a89e1b99c50e64aec54f5a082d2beecc 100644 (file)
@@ -40,9 +40,12 @@ get_log_var_expand_table(struct mail_deliver_context *ctx, const char *message)
                { 'm', NULL, "msgid" },
                { 's', NULL, "subject" },
                { 'f', NULL, "from" },
+               { 'p', NULL, "size" },
+               { 'w', NULL, "vsize" },
                { '\0', NULL, NULL }
        };
        struct var_expand_table *tab;
+       uoff_t size;
        unsigned int i;
 
        tab = t_malloc(sizeof(static_tab));
@@ -52,6 +55,10 @@ get_log_var_expand_table(struct mail_deliver_context *ctx, const char *message)
        (void)mail_get_first_header(ctx->src_mail, "Message-ID", &tab[1].value);
        (void)mail_get_first_header_utf8(ctx->src_mail, "Subject", &tab[2].value);
        tab[3].value = mail_deliver_get_address(ctx, "From");
+       if (mail_get_physical_size(ctx->src_mail, &size) == 0)
+               tab[4].value = dec2str(size);
+       if (mail_get_virtual_size(ctx->src_mail, &size) == 0)
+               tab[5].value = dec2str(size);
        for (i = 1; tab[i].key != '\0'; i++)
                tab[i].value = str_sanitize(tab[i].value, 80);
        return tab;