dovecot-2.1: imapc: Another try at fixing mUTF-7 mailbox names.

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 9 13:05:44 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/0801852b2156
changeset: 13439:0801852b2156
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 09 13:05:33 2011 +0300
description:
imapc: Another try at fixing mUTF-7 mailbox names.

diffstat:

 src/lib-storage/index/imapc/imapc-list.c    |   2 +-
 src/lib-storage/index/imapc/imapc-save.c    |   3 +--
 src/lib-storage/index/imapc/imapc-storage.c |  20 ++++----------------
 src/lib-storage/index/imapc/imapc-storage.h |   1 -
 4 files changed, 6 insertions(+), 20 deletions(-)

diffs (87 lines):

diff -r 92ab9fa4ec36 -r 0801852b2156 src/lib-storage/index/imapc/imapc-list.c
--- a/src/lib-storage/index/imapc/imapc-list.c	Fri Sep 09 12:57:36 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-list.c	Fri Sep 09 13:05:33 2011 +0300
@@ -87,7 +87,7 @@
 	T_BEGIN {
 		string_t *utf8_name = t_str_new(64);
 
-		if (imap_utf7_to_utf8(name, utf8_name)) {
+		if (imap_utf7_to_utf8(name, utf8_name) < 0) {
 			str_truncate(utf8_name, 0);
 			str_append(utf8_name, name);
 		}
diff -r 92ab9fa4ec36 -r 0801852b2156 src/lib-storage/index/imapc/imapc-save.c
--- a/src/lib-storage/index/imapc/imapc-save.c	Fri Sep 09 12:57:36 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-save.c	Fri Sep 09 13:05:33 2011 +0300
@@ -335,8 +335,7 @@
 		imapc_client_mailbox_cmdf(src_mbox->client_box,
 					  imapc_copy_callback, &sctx,
 					  "UID COPY %u %s",
-					  mail->uid,
-					  imapc_mutf7_mailbox_name(_t->box));
+					  mail->uid, _t->box->name);
 		while (sctx.ret == -2)
 			imapc_storage_run(src_mbox->storage);
 		ctx->finished = TRUE;
diff -r 92ab9fa4ec36 -r 0801852b2156 src/lib-storage/index/imapc/imapc-storage.c
--- a/src/lib-storage/index/imapc/imapc-storage.c	Fri Sep 09 12:57:36 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-storage.c	Fri Sep 09 13:05:33 2011 +0300
@@ -363,15 +363,6 @@
 	imapc_client_stop(ctx->mbox->storage->client);
 }
 
-const char *imapc_mutf7_mailbox_name(struct mailbox *box)
-{
-	const char *mutf7_name;
-
-	if (t_imap_utf8_to_utf7(box->name, &mutf7_name) < 0)
-		i_unreached();
-	return mutf7_name;
-}
-
 static int imapc_mailbox_open(struct mailbox *box)
 {
 	struct imapc_mailbox *mbox = (struct imapc_mailbox *)box;
@@ -392,8 +383,7 @@
 	ctx.mbox = mbox;
 	ctx.ret = -2;
 	mbox->client_box =
-		imapc_client_mailbox_open(mbox->storage->client,
-					  imapc_mutf7_mailbox_name(box),
+		imapc_client_mailbox_open(mbox->storage->client, box->name,
 					  examine, imapc_mailbox_open_callback,
 					  &ctx, mbox);
 	while (ctx.ret == -2)
@@ -434,7 +424,7 @@
 {
 	struct imapc_mailbox *mbox = (struct imapc_mailbox *)box;
 	struct imapc_simple_context sctx;
-	const char *name = imapc_mutf7_mailbox_name(box);
+	const char *name = box->name;
 
 	if (directory) {
 		name = t_strdup_printf("%s%c", name,
@@ -552,10 +542,8 @@
 	imapc_simple_context_init(&sctx, mbox->storage);
 	mbox->storage->cur_status_box = mbox;
 	mbox->storage->cur_status = status_r;
-	imapc_client_cmdf(mbox->storage->client,
-			  imapc_simple_callback, &sctx,
-			  "STATUS %s (%1s)", imapc_mutf7_mailbox_name(box),
-			  str_c(str)+1);
+	imapc_client_cmdf(mbox->storage->client, imapc_simple_callback, &sctx,
+			  "STATUS %s (%1s)", box->name, str_c(str)+1);
 	imapc_simple_run(&sctx);
 	mbox->storage->cur_status_box = NULL;
 	mbox->storage->cur_status = NULL;
diff -r 92ab9fa4ec36 -r 0801852b2156 src/lib-storage/index/imapc/imapc-storage.h
--- a/src/lib-storage/index/imapc/imapc-storage.h	Fri Sep 09 12:57:36 2011 +0300
+++ b/src/lib-storage/index/imapc/imapc-storage.h	Fri Sep 09 13:05:33 2011 +0300
@@ -90,7 +90,6 @@
 
 void imapc_storage_run(struct imapc_storage *storage);
 
-const char *imapc_mutf7_mailbox_name(struct mailbox *box);
 void imapc_copy_error_from_reply(struct imapc_storage *storage,
 				 enum mail_error default_error,
 				 const struct imapc_command_reply *reply);


More information about the dovecot-cvs mailing list