diff src/plugins/lazy-expunge/lazy-expunge-plugin.c @ 12585:b748c622e896

lib-storage: Added mailbox_get_last_*error() wrappers and use them.
author Timo Sirainen <tss@iki.fi>
date Thu, 20 Jan 2011 19:21:20 +0200
parents 57d7ea7fa5f6
children 82f984d7a241
line wrap: on
line diff
--- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Thu Jan 20 18:17:22 2011 +0200
+++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c	Thu Jan 20 19:21:20 2011 +0200
@@ -83,8 +83,7 @@
 		return box;
 	}
 
-	*error_r = mail_storage_get_last_error(mailbox_get_storage(box),
-					       &error);
+	*error_r = mailbox_get_last_error(box, &error);
 	if (error != MAIL_ERROR_NOTFOUND) {
 		mailbox_free(&box);
 		return NULL;
@@ -93,8 +92,7 @@
 	/* try creating and re-opening it. */
 	if (mailbox_create(box, NULL, FALSE) < 0 ||
 	    mailbox_open(box) < 0) {
-		*error_r = mail_storage_get_last_error(mailbox_get_storage(box),
-						       NULL);
+		*error_r = mailbox_get_last_error(box, NULL);
 		mailbox_free(&box);
 		return NULL;
 	}
@@ -263,7 +261,7 @@
 			break;
 		mailbox_free(&dest_box);
 
-		mail_storage_get_last_error(src_box->storage, &error);
+		error = mailbox_get_last_mail_error(src_box);
 		switch (error) {
 		case MAIL_ERROR_EXISTS:
 			break;
@@ -292,12 +290,11 @@
 	struct mail_save_context *save_ctx;
 	struct mail *mail;
 	const char *errstr;
-	enum mail_error error;
 	int ret;
 
 	dest_box = mailbox_alloc(src_box->list, dest_name, 0);
 	if (mailbox_open(dest_box) < 0) {
-		errstr = mail_storage_get_last_error(dest_box->storage, &error);
+		errstr = mailbox_get_last_error(dest_box, NULL);
 		i_error("lazy_expunge: Couldn't open DELETE dest mailbox "
 			"%s: %s", dest_name, errstr);
 		mailbox_free(&dest_box);
@@ -366,7 +363,6 @@
 	struct mail_namespace *expunge_ns, *dest_ns;
 	struct mailbox *expunge_box;
 	const char *destname, *str;
-	enum mail_error error;
 	struct tm *tm;
 	char timestamp[256];
 	int ret;
@@ -412,7 +408,7 @@
 	   since it's not really deleted in the lazy-expunge namespace,
 	   we might want to change it again. so mark the index undeleted. */
 	if (mailbox_open(expunge_box) < 0) {
-		str = mail_storage_get_last_error(expunge_box->storage, &error);
+		str = mailbox_get_last_error(expunge_box, NULL);
 		i_error("lazy_expunge: Couldn't open DELETEd mailbox "
 			"%s: %s", expunge_box->name, str);
 		mailbox_free(&expunge_box);