}
str_append(msg, msg_suffix);
str_append_c(msg, '.');
- ctx->client->append_count += save_count;
+ ctx->client->logout_stats.append_count += save_count;
pool_unref(&changes.pool);
if (ctx->box == cmd->client->mailbox) {
i_assert(client->mailbox_change_lock == NULL);
storage = mailbox_get_storage(mailbox);
- if (imap_expunge(mailbox, NULL, &client->expunged_count) < 0) {
+ if (imap_expunge(mailbox, NULL, &client->logout_stats.expunged_count) < 0) {
errstr = mailbox_get_last_error(mailbox, &error);
if (error != MAIL_ERROR_PERM)
client_send_untagged_storage_error(client, storage);
if (set != NULL && array_not_empty(&set->special_use) &&
str_array_icase_find(settings_boollist_get(&set->special_use),
"\\Trash"))
- client->trashed_count += count;
+ client->logout_stats.trashed_count += count;
}
static bool client_is_disconnected(struct client *client)
int ret;
ret = imap_expunge(client->mailbox, search_args == NULL ? NULL :
- search_args->args, &client->expunged_count);
+ search_args->args, &client->logout_stats.expunged_count);
if (search_args != NULL)
mail_search_args_unref(&search_args);
if (ret < 0) {
client_send_box_error(cmd, client->mailbox);
return TRUE;
}
- client->deleted_count += deleted_count;
+ client->logout_stats.deleted_count += deleted_count;
if (array_count(&modified_set) == 0)
tagged_reply = "OK Store completed.";
{ .key = "input", .value = dec2str(i_stream_get_absolute_offset(client->input)) },
{ .key = "output", .value = dec2str(client->output->offset) },
{ .key = "session", .value = client->user->session_id },
- { .key = "fetch_hdr_count", .value = dec2str(client->fetch_hdr_count) },
- { .key = "fetch_hdr_bytes", .value = dec2str(client->fetch_hdr_bytes) },
- { .key = "fetch_body_count", .value = dec2str(client->fetch_body_count) },
- { .key = "fetch_body_bytes", .value = dec2str(client->fetch_body_bytes) },
- { .key = "deleted", .value = dec2str(client->deleted_count) },
- { .key = "expunged", .value = dec2str(client->expunged_count) },
- { .key = "trashed", .value = dec2str(client->trashed_count) },
- { .key = "autoexpunged", .value = dec2str(client->autoexpunged_count) },
- { .key = "appended", .value = dec2str(client->append_count) },
+ { .key = "fetch_hdr_count", .value = dec2str(client->logout_stats.fetch_hdr_count) },
+ { .key = "fetch_hdr_bytes", .value = dec2str(client->logout_stats.fetch_hdr_bytes) },
+ { .key = "fetch_body_count", .value = dec2str(client->logout_stats.fetch_body_count) },
+ { .key = "fetch_body_bytes", .value = dec2str(client->logout_stats.fetch_body_bytes) },
+ { .key = "deleted", .value = dec2str(client->logout_stats.deleted_count) },
+ { .key = "expunged", .value = dec2str(client->logout_stats.expunged_count) },
+ { .key = "trashed", .value = dec2str(client->logout_stats.trashed_count) },
+ { .key = "autoexpunged", .value = dec2str(client->logout_stats.autoexpunged_count) },
+ { .key = "appended", .value = dec2str(client->logout_stats.append_count) },
VAR_EXPAND_TABLE_END
};
const struct var_expand_params *user_params =
hibernations it could also be doing unnecessarily much work. */
imap_refresh_proctitle();
if (!client->hibernated) {
- client->autoexpunged_count = mail_user_autoexpunge(client->user);
+ client->logout_stats.autoexpunged_count = mail_user_autoexpunge(client->user);
client_log_disconnect(client, reason);
}
mail_user_deinit(&client->user);
#define IMAP_CLIENT_H
#include "imap-commands.h"
+#include "imap-stats.h"
#include "message-size.h"
#define CLIENT_COMMAND_QUEUE_MAX_SIZE 4
uint64_t highest_fetch_modseq;
ARRAY_TYPE(seq_range) fetch_failed_uids;
- /* For imap_logout_format statistics: */
- 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, append_count;
+ struct imap_logout_stats logout_stats;
/* SEARCHRES extension: Last saved SEARCH result */
ARRAY_TYPE(seq_range) search_saved_uidset;
const struct imap_msgpart *msgpart)
{
if (!imap_msgpart_contains_body(msgpart)) {
- ctx->client->fetch_hdr_count++;
- ctx->state.cur_stats_sizep = &ctx->client->fetch_hdr_bytes;
+ ctx->client->logout_stats.fetch_hdr_count++;
+ ctx->state.cur_stats_sizep = &ctx->client->logout_stats.fetch_hdr_bytes;
} else {
- ctx->client->fetch_body_count++;
- ctx->state.cur_stats_sizep = &ctx->client->fetch_body_bytes;
+ ctx->client->logout_stats.fetch_body_count++;
+ ctx->state.cur_stats_sizep = &ctx->client->logout_stats.fetch_body_bytes;
}
}
imap-parser.h \
imap-resp-code.h \
imap-quote.h \
+ imap-stats.h \
imap-url.h \
imap-seqset.h \
imap-utf7.h \
--- /dev/null
+#ifndef IMAP_STATS_H
+#define IMAP_STATS_H
+
+/* Statistics that are used in the imap_logout_format message. */
+struct imap_logout_stats {
+ 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, append_count;
+};
+
+#endif /* IMAP_STATS_H */