[dovecot-cvs] dovecot/src/imap cmd-delete.c, 1.12, 1.13 cmd-list.c, 1.69, 1.70 cmd-rename.c, 1.10, 1.11 commands-util.c, 1.55, 1.56 commands-util.h, 1.28, 1.29

tss at dovecot.org tss at dovecot.org
Sun May 13 19:13:52 EEST 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv19261/imap

Modified Files:
	cmd-delete.c cmd-list.c cmd-rename.c commands-util.c 
	commands-util.h 
Log Message:
Removed mail_storage_set_list_error(). Handle the errors directly.



Index: cmd-delete.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-delete.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmd-delete.c	29 Mar 2007 07:59:26 -0000	1.12
+++ cmd-delete.c	13 May 2007 16:13:48 -0000	1.13
@@ -43,10 +43,9 @@
 	}
 
 	list = mail_storage_get_list(storage);
-	if (mailbox_list_delete_mailbox(list, name) < 0) {
-		mail_storage_set_list_error(storage);
-		client_send_storage_error(cmd, storage);
-	} else {
+	if (mailbox_list_delete_mailbox(list, name) < 0)
+		client_send_list_error(cmd, list);
+	else {
 		client_send_tagline(cmd, "OK Delete completed.");
 	}
 	return TRUE;

Index: cmd-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-list.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- cmd-list.c	17 Apr 2007 16:04:15 -0000	1.69
+++ cmd-list.c	13 May 2007 16:13:48 -0000	1.70
@@ -175,10 +175,8 @@
 		}
 	}
 
-	if (mailbox_list_iter_deinit(&ctx->list_iter) < 0) {
-		mail_storage_set_list_error(ctx->ns->storage);
+	if (mailbox_list_iter_deinit(&ctx->list_iter) < 0)
 		ret = -1;
-	}
 
 	if (ret == 0)
 		list_namespace_inbox(client, ctx);
@@ -236,7 +234,6 @@
 	const char *cur_ns_prefix, *cur_ref, *cur_mask;
 	enum imap_match_result match;
 	enum imap_match_result inbox_match;
-	struct mailbox_list *list;
 	struct imap_match_glob *inbox_glob;
 	unsigned int count;
 	size_t len;
@@ -394,9 +391,8 @@
 	cur_ref = mail_namespace_fix_sep(ns, cur_ref);
 	cur_mask = mail_namespace_fix_sep(ns, cur_mask);
 
-	list = mail_storage_get_list(ns->storage);
-	cur_mask = mailbox_list_join_refmask(list, cur_ref, cur_mask);
-	ctx->list_iter = mailbox_list_iter_init(list, cur_mask,
+	cur_mask = mailbox_list_join_refmask(ns->list, cur_ref, cur_mask);
+	ctx->list_iter = mailbox_list_iter_init(ns->list, cur_mask,
 						ctx->list_flags);
 }
 
@@ -407,10 +403,8 @@
 	int ret;
 
 	if (cmd->cancel) {
-		if (ctx->list_iter != NULL) {
-			if (mailbox_list_iter_deinit(&ctx->list_iter) < 0)
-				mail_storage_set_list_error(ctx->ns->storage);
-		}
+		if (ctx->list_iter != NULL)
+			(void)mailbox_list_iter_deinit(&ctx->list_iter);
 		return TRUE;
 	}
 	for (; ctx->ns != NULL; ctx->ns = ctx->ns->next) {
@@ -418,7 +412,7 @@
 			list_namespace_init(cmd, ctx);
 
 		if ((ret = list_namespace_mailboxes(client, ctx)) < 0) {
-			client_send_storage_error(cmd, ctx->ns->storage);
+			client_send_list_error(cmd, ctx->ns->list);
 			return TRUE;
 		}
 		if (ret == 0)

Index: cmd-rename.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-rename.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cmd-rename.c	29 Mar 2007 07:59:26 -0000	1.10
+++ cmd-rename.c	13 May 2007 16:13:48 -0000	1.11
@@ -31,10 +31,9 @@
 	}
 
 	list = mail_storage_get_list(old_storage);
-	if (mailbox_list_rename_mailbox(list, oldname, newname) < 0) {
-		mail_storage_set_list_error(old_storage);
-		client_send_storage_error(cmd, old_storage);
-	} else {
+	if (mailbox_list_rename_mailbox(list, oldname, newname) < 0)
+		client_send_list_error(cmd, list);
+	else {
 		client_send_tagline(cmd, "OK Rename completed.");
 	}
 	return TRUE;

Index: commands-util.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/commands-util.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- commands-util.c	13 May 2007 15:46:07 -0000	1.55
+++ commands-util.c	13 May 2007 16:13:48 -0000	1.56
@@ -143,6 +143,16 @@
 	}
 }
 
+void client_send_list_error(struct client_command_context *cmd,
+			    struct mailbox_list *list)
+{
+	const char *error;
+	bool temporary_error;
+
+	error = mailbox_list_get_last_error(list, &temporary_error);
+	client_send_tagline(cmd, t_strconcat("NO ", error, NULL));
+}
+
 void client_send_storage_error(struct client_command_context *cmd,
 			       struct mail_storage *storage)
 {

Index: commands-util.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/commands-util.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- commands-util.h	3 Apr 2007 08:34:29 -0000	1.28
+++ commands-util.h	13 May 2007 16:13:48 -0000	1.29
@@ -32,6 +32,9 @@
    error message to client. */
 bool client_verify_open_mailbox(struct client_command_context *cmd);
 
+/* Send last mailbox list error message to client. */
+void client_send_list_error(struct client_command_context *cmd,
+			    struct mailbox_list *list);
 /* Send last mail storage error message to client. */
 void client_send_storage_error(struct client_command_context *cmd,
 			       struct mail_storage *storage);



More information about the dovecot-cvs mailing list