changeset 22377:3e292bfb7afa

imap: Add %{appended} to imap_logout_format
author Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
date Tue, 11 Jul 2017 13:12:46 +0300
parents dacbb97f754c
children 2356b44ebec8
files doc/example-config/conf.d/20-imap.conf src/imap/cmd-append.c src/imap/imap-client.c src/imap/imap-client.h
diffstat 4 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/example-config/conf.d/20-imap.conf	Mon Jul 03 17:12:08 2017 +0300
+++ b/doc/example-config/conf.d/20-imap.conf	Tue Jul 11 13:12:46 2017 +0300
@@ -27,6 +27,7 @@
 #                    client disconnected
 #  %{trashed} - Number of mails that client copied/moved to the
 #               special_use=\Trash mailbox.
+#  %{appended} - Number of mails saved during the session
 #imap_logout_format = in=%i out=%o
 
 # Override the IMAP CAPABILITY response. If the value begins with '+',
--- a/src/imap/cmd-append.c	Mon Jul 03 17:12:08 2017 +0300
+++ b/src/imap/cmd-append.c	Tue Jul 11 13:12:46 2017 +0300
@@ -665,6 +665,7 @@
 		imap_write_seq_range(msg, &changes.saved_uids);
 		str_append(msg, "] Append completed.");
 	}
+	ctx->client->append_count += save_count;
 	pool_unref(&changes.pool);
 
 	if (ctx->box == cmd->client->mailbox) {
--- a/src/imap/imap-client.c	Mon Jul 03 17:12:08 2017 +0300
+++ b/src/imap/imap-client.c	Tue Jul 11 13:12:46 2017 +0300
@@ -245,6 +245,7 @@
 		{ '\0', NULL, "expunged" },
 		{ '\0', NULL, "trashed" },
 		{ '\0', NULL, "autoexpunged" },
+		{ '\0', NULL, "appended" },
 		{ '\0', NULL, NULL }
 	};
 	struct var_expand_table *tab;
@@ -264,6 +265,7 @@
 	tab[8].value = dec2str(client->expunged_count);
 	tab[9].value = dec2str(client->trashed_count);
 	tab[10].value = dec2str(client->autoexpunged_count);
+	tab[11].value = dec2str(client->append_count);
 
 	str = t_str_new(128);
 	var_expand(str, client->set->imap_logout_format, tab);
--- a/src/imap/imap-client.h	Mon Jul 03 17:12:08 2017 +0300
+++ b/src/imap/imap-client.h	Tue Jul 11 13:12:46 2017 +0300
@@ -188,7 +188,7 @@
 	unsigned int fetch_hdr_count, fetch_body_count;
 	uint64_t fetch_hdr_bytes, fetch_body_bytes;
 	unsigned int deleted_count, expunged_count, trashed_count;
-	unsigned int autoexpunged_count;
+	unsigned int autoexpunged_count, append_count;
 
 	/* SEARCHRES extension: Last saved SEARCH result */
 	ARRAY_TYPE(seq_range) search_saved_uidset;