dovecot-2.0: deliver_log_format: Added support for size and vsize
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 21 19:58:59 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/6a27203d4439
changeset: 11182:6a27203d4439
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 21 19:58:10 2010 +0300
description:
deliver_log_format: Added support for size and vsize
diffstat:
doc/example-config/conf.d/10-logging.conf | 2 ++
src/lib-lda/mail-deliver.c | 7 +++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diffs (37 lines):
diff -r b6b81af98381 -r 6a27203d4439 doc/example-config/conf.d/10-logging.conf
--- a/doc/example-config/conf.d/10-logging.conf Tue Apr 20 18:26:28 2010 +0300
+++ b/doc/example-config/conf.d/10-logging.conf Wed Apr 21 19:58:10 2010 +0300
@@ -80,4 +80,6 @@
# %m - Message-ID
# %s - Subject
# %f - From address
+# %p - Physical size
+# %w - Virtual size
#deliver_log_format = msgid=%m: %$
diff -r b6b81af98381 -r 6a27203d4439 src/lib-lda/mail-deliver.c
--- a/src/lib-lda/mail-deliver.c Tue Apr 20 18:26:28 2010 +0300
+++ b/src/lib-lda/mail-deliver.c Wed Apr 21 19:58:10 2010 +0300
@@ -40,9 +40,12 @@
{ '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 @@
(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;
More information about the dovecot-cvs
mailing list