[dovecot-cvs] dovecot/src/plugins/lazy-expunge lazy-expunge-plugin.c, 1.10, 1.11

tss at dovecot.org tss at dovecot.org
Sun May 13 20:11:05 EEST 2007


Update of /var/lib/cvs/dovecot/src/plugins/lazy-expunge
In directory talvi:/tmp/cvs-serv20721/plugins/lazy-expunge

Modified Files:
	lazy-expunge-plugin.c 
Log Message:
Error handling rewrite.



Index: lazy-expunge-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/lazy-expunge/lazy-expunge-plugin.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- lazy-expunge-plugin.c	13 May 2007 15:46:09 -0000	1.10
+++ lazy-expunge-plugin.c	13 May 2007 17:11:03 -0000	1.11
@@ -69,7 +69,7 @@
 mailbox_open_or_create(struct mail_storage *storage, const char *name)
 {
 	struct mailbox *box;
-	bool temp;
+	enum mail_error error;
 
 	box = mailbox_open(storage, name, NULL, MAILBOX_OPEN_FAST |
 			   MAILBOX_OPEN_KEEP_RECENT |
@@ -77,11 +77,11 @@
 	if (box != NULL)
 		return box;
 
-	(void)mail_storage_get_last_error(storage, &temp);
-	if (temp)
+	(void)mail_storage_get_last_error(storage, &error);
+	if (error != MAIL_ERROR_NOTFOUND)
 		return NULL;
 
-	/* probably the mailbox just doesn't exist. try creating it. */
+	/* try creating it. */
 	if (mail_storage_mailbox_create(storage, name, FALSE) < 0)
 		return NULL;
 
@@ -428,14 +428,16 @@
 
 	/* first do the normal sanity checks */
 	if (strcmp(name, "INBOX") == 0) {
-		mailbox_list_set_error(list, "INBOX can't be deleted.");
+		mailbox_list_set_error(list, MAIL_ERROR_NOTPOSSIBLE,
+				       "INBOX can't be deleted.");
 		return -1;
 	}
 
 	if (mailbox_list_get_mailbox_name_status(list, name, &status) < 0)
 		return -1;
 	if (status == MAILBOX_NAME_INVALID) {
-		mailbox_list_set_error(list, "Invalid mailbox name");
+		mailbox_list_set_error(list, MAIL_ERROR_PARAMS,
+				       "Invalid mailbox name");
 		return -1;
 	}
 
@@ -450,8 +452,8 @@
 	if ((ret = mailbox_move(list, name, dest_list, &destname)) < 0)
 		return -1;
 	if (ret == 0) {
-		mailbox_list_set_error(list, t_strdup_printf(
-			MAILBOX_LIST_ERR_MAILBOX_NOT_FOUND, name));
+		mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+			T_MAIL_ERR_MAILBOX_NOT_FOUND(name));
 		return -1;
 	}
 



More information about the dovecot-cvs mailing list