Mercurial > dovecot > core-2.2
comparison src/doveadm/doveadm-mail-mailbox-status.c @ 12629:02370eda76f8
lib-storage: Mailbox virtual names are now in UTF-8 format, not IMAP mUTF-7.
Plugins that use mailbox names in configuration now take them also as UTF-8
rather than mUTF-7.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 01 Feb 2011 20:41:54 +0200 |
parents | 2c299c0e3bc8 |
children | 447bce266022 |
comparison
equal
deleted
inserted
replaced
12628:49f487b435bd | 12629:02370eda76f8 |
---|---|
2 | 2 |
3 #include "lib.h" | 3 #include "lib.h" |
4 #include "str.h" | 4 #include "str.h" |
5 #include "mail-namespace.h" | 5 #include "mail-namespace.h" |
6 #include "mail-storage.h" | 6 #include "mail-storage.h" |
7 #include "imap-utf7.h" | |
8 #include "doveadm-print.h" | 7 #include "doveadm-print.h" |
9 #include "doveadm-mail.h" | 8 #include "doveadm-mail.h" |
10 #include "doveadm-mail-list-iter.h" | 9 #include "doveadm-mail-list-iter.h" |
11 | 10 |
12 #define ALL_STATUS_ITEMS \ | 11 #define ALL_STATUS_ITEMS \ |
78 | 77 |
79 static void status_output(struct status_cmd_context *ctx, struct mailbox *box, | 78 static void status_output(struct status_cmd_context *ctx, struct mailbox *box, |
80 const struct mailbox_status *status, | 79 const struct mailbox_status *status, |
81 const struct mailbox_metadata *metadata) | 80 const struct mailbox_metadata *metadata) |
82 { | 81 { |
83 string_t *name; | 82 if (box != NULL) |
84 | 83 doveadm_print(mailbox_get_vname(box)); |
85 if (box != NULL) { | |
86 name = t_str_new(128); | |
87 if (imap_utf7_to_utf8(mailbox_get_vname(box), name) < 0) { | |
88 str_truncate(name, 0); | |
89 str_append(name, mailbox_get_vname(box)); | |
90 } | |
91 doveadm_print(str_c(name)); | |
92 } | |
93 | 84 |
94 if ((ctx->status_items & STATUS_MESSAGES) != 0) | 85 if ((ctx->status_items & STATUS_MESSAGES) != 0) |
95 doveadm_print_num(status->messages); | 86 doveadm_print_num(status->messages); |
96 if ((ctx->status_items & STATUS_RECENT) != 0) | 87 if ((ctx->status_items & STATUS_RECENT) != 0) |
97 doveadm_print_num(status->recent); | 88 doveadm_print_num(status->recent); |
126 status_mailbox(struct status_cmd_context *ctx, const struct mailbox_info *info) | 117 status_mailbox(struct status_cmd_context *ctx, const struct mailbox_info *info) |
127 { | 118 { |
128 struct mailbox *box; | 119 struct mailbox *box; |
129 struct mailbox_status status; | 120 struct mailbox_status status; |
130 struct mailbox_metadata metadata; | 121 struct mailbox_metadata metadata; |
131 string_t *mailbox_name = t_str_new(128); | 122 |
132 | 123 box = doveadm_mailbox_find(ctx->ctx.cur_mail_user, info->name); |
133 if (imap_utf7_to_utf8(info->name, mailbox_name) < 0) { | |
134 str_truncate(mailbox_name, 0); | |
135 str_append(mailbox_name, info->name); | |
136 } | |
137 | |
138 box = doveadm_mailbox_find(ctx->ctx.cur_mail_user, str_c(mailbox_name)); | |
139 if (mailbox_get_status(box, ctx->status_items, &status) < 0 || | 124 if (mailbox_get_status(box, ctx->status_items, &status) < 0 || |
140 mailbox_get_metadata(box, ctx->metadata_items, &metadata) < 0) { | 125 mailbox_get_metadata(box, ctx->metadata_items, &metadata) < 0) { |
141 ctx->ctx.failed = TRUE; | 126 ctx->ctx.failed = TRUE; |
142 mailbox_free(&box); | 127 mailbox_free(&box); |
143 return; | 128 return; |