From: Timo Sirainen Date: Wed, 21 Apr 2010 16:58:10 +0000 (+0300) Subject: deliver_log_format: Added support for size and vsize X-Git-Tag: 2.0.beta5~92 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1695984ac979204fffb3458ae7f8499ad36339cc;p=thirdparty%2Fdovecot%2Fcore.git deliver_log_format: Added support for size and vsize --HG-- branch : HEAD --- diff --git a/doc/example-config/conf.d/10-logging.conf b/doc/example-config/conf.d/10-logging.conf index 75505ffa4b..06457c9d7a 100644 --- a/doc/example-config/conf.d/10-logging.conf +++ b/doc/example-config/conf.d/10-logging.conf @@ -80,4 +80,6 @@ plugin { # %m - Message-ID # %s - Subject # %f - From address +# %p - Physical size +# %w - Virtual size #deliver_log_format = msgid=%m: %$ diff --git a/src/lib-lda/mail-deliver.c b/src/lib-lda/mail-deliver.c index c6b9a6109d..f3c15687a8 100644 --- a/src/lib-lda/mail-deliver.c +++ b/src/lib-lda/mail-deliver.c @@ -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;