changeset 22376:dacbb97f754c

imap-client: Add %{autoexpunged} to imap_logout_format
author Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
date Mon, 03 Jul 2017 17:12:08 +0300
parents 06def4e9a4a2
children 3e292bfb7afa
files doc/example-config/conf.d/20-imap.conf src/imap/imap-client.c src/imap/imap-client.h
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/doc/example-config/conf.d/20-imap.conf	Tue Jul 04 09:25:21 2017 +0300
+++ b/doc/example-config/conf.d/20-imap.conf	Mon Jul 03 17:12:08 2017 +0300
@@ -21,7 +21,10 @@
 #  %{fetch_body_count} - Number of mails with mail body data sent to client
 #  %{fetch_body_bytes} - Number of bytes with mail body data sent to client
 #  %{deleted} - Number of mails where client added \Deleted flag
-#  %{expunged} - Number of mails that client expunged
+#  %{expunged} - Number of mails that client expunged, which does not
+#                include automatically expunged mails
+#  %{autoexpunged} - Number of mails that were automatically expunged after
+#                    client disconnected
 #  %{trashed} - Number of mails that client copied/moved to the
 #               special_use=\Trash mailbox.
 #imap_logout_format = in=%i out=%o
--- a/src/imap/imap-client.c	Tue Jul 04 09:25:21 2017 +0300
+++ b/src/imap/imap-client.c	Mon Jul 03 17:12:08 2017 +0300
@@ -244,6 +244,7 @@
 		{ '\0', NULL, "deleted" },
 		{ '\0', NULL, "expunged" },
 		{ '\0', NULL, "trashed" },
+		{ '\0', NULL, "autoexpunged" },
 		{ '\0', NULL, NULL }
 	};
 	struct var_expand_table *tab;
@@ -262,6 +263,7 @@
 	tab[7].value = dec2str(client->deleted_count);
 	tab[8].value = dec2str(client->expunged_count);
 	tab[9].value = dec2str(client->trashed_count);
+	tab[10].value = dec2str(client->autoexpunged_count);
 
 	str = t_str_new(128);
 	var_expand(str, client->set->imap_logout_format, tab);
@@ -459,7 +461,7 @@
 	   hibernations it could also be doing unnecessarily much work. */
 	imap_refresh_proctitle();
 	if (!client->hibernated) {
-		mail_user_autoexpunge(client->user);
+		client->autoexpunged_count = mail_user_autoexpunge(client->user);
 		client_log_disconnect(client, reason);
 	}
 	mail_user_unref(&client->user);
--- a/src/imap/imap-client.h	Tue Jul 04 09:25:21 2017 +0300
+++ b/src/imap/imap-client.h	Mon Jul 03 17:12:08 2017 +0300
@@ -188,6 +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;
 
 	/* SEARCHRES extension: Last saved SEARCH result */
 	ARRAY_TYPE(seq_range) search_saved_uidset;