Skip to content

Commit

Permalink
imap: Include mail user variables in logout format
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse committed Dec 7, 2017
1 parent 857a9e1 commit ee1950c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/imap/imap-client.c
Expand Up @@ -237,7 +237,7 @@ void client_command_cancel(struct client_command_context **_cmd)

const char *client_stats(struct client *client)
{
const struct var_expand_table tab[] = {
const struct var_expand_table logout_tab[] = {
{ 'i', dec2str(i_stream_get_absolute_offset(client->input)), "input" },
{ 'o', dec2str(client->output->offset), "output" },
{ '\0', client->session_id, "session" },
Expand All @@ -252,11 +252,17 @@ const char *client_stats(struct client *client)
{ '\0', dec2str(client->append_count), "appended" },
{ '\0', NULL, NULL }
};
const struct var_expand_table *user_tab =
mail_user_var_expand_table(client->user);
const struct var_expand_table *tab =
t_var_expand_merge_tables(logout_tab, user_tab);
string_t *str;
const char *error;

str = t_str_new(128);
if (var_expand(str, client->set->imap_logout_format, tab, &error) <= 0) {
if (var_expand_with_funcs(str, client->set->imap_logout_format,
tab, mail_user_var_expand_func_table,
client->user, &error) < 0) {
i_error("Failed to expand imap_logout_format=%s: %s",
client->set->imap_logout_format, error);
}
Expand Down

0 comments on commit ee1950c

Please sign in to comment.