[dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.17, 1.18 mail-storage.c, 1.40, 1.41 mail-storage.h, 1.96, 1.97

cras at dovecot.org cras at dovecot.org
Fri Jul 29 11:43:07 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv30221/lib-storage

Modified Files:
	mail-storage-private.h mail-storage.c mail-storage.h 
Log Message:
Added separate "temporary error" flag for mail_storage_get_last_error().



Index: mail-storage-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage-private.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mail-storage-private.h	3 Apr 2005 11:36:15 -0000	1.17
+++ mail-storage-private.h	29 Jul 2005 08:43:04 -0000	1.18
@@ -47,7 +47,8 @@
 				       enum mailbox_name_status *status);
 
 	const char *(*get_last_error)(struct mail_storage *storage,
-				      int *syntax_error_r);
+				      int *syntax_error_r,
+				      int *temporary_error_r);
 };
 
 struct mail_storage {
@@ -66,7 +67,11 @@
 	/* Module-specific contexts. See mail_storage_module_id. */
 	array_t ARRAY_DEFINE(module_contexts, void);
 
-	unsigned int syntax_error:1; /* Give a BAD reply instead of NO */
+	/* IMAP: Give a BAD reply instead of NO */
+	unsigned int syntax_error:1;
+	/* Internal temporary error, as opposed to visible user errors like
+	   "permission denied" or "out of disk space" */
+	unsigned int temporary_error:1;
 };
 
 struct mailbox_vfuncs {

Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- mail-storage.c	4 Jul 2005 11:32:21 -0000	1.40
+++ mail-storage.c	29 Jul 2005 08:43:04 -0000	1.41
@@ -153,20 +153,18 @@
 	storage->error = NULL;
 
 	storage->syntax_error = FALSE;
+	storage->temporary_error = FALSE;
 }
 
 void mail_storage_set_error(struct mail_storage *storage, const char *fmt, ...)
 {
 	va_list va;
 
-	i_free(storage->error);
+	mail_storage_clear_error(storage);
 
-	if (fmt == NULL)
-		storage->error = NULL;
-	else {
+	if (fmt != NULL) {
 		va_start(va, fmt);
 		storage->error = i_strdup_vprintf(fmt, va);
-		storage->syntax_error = FALSE;
 		va_end(va);
 	}
 }
@@ -176,11 +174,9 @@
 {
 	va_list va;
 
-	i_free(storage->error);
+	mail_storage_clear_error(storage);
 
-	if (fmt == NULL)
-		storage->error = NULL;
-	else {
+	if (fmt != NULL) {
 		va_start(va, fmt);
 		storage->error = i_strdup_vprintf(fmt, va);
 		storage->syntax_error = TRUE;
@@ -200,6 +196,7 @@
 		strftime(str, sizeof(str), CRITICAL_MSG_STAMP, tm) > 0 ?
 		i_strdup(str) : i_strdup(CRITICAL_MSG);
 	storage->syntax_error = FALSE;
+	storage->temporary_error = TRUE;
 }
 
 void mail_storage_set_critical(struct mail_storage *storage,
@@ -207,10 +204,8 @@
 {
 	va_list va;
 
-	i_free(storage->error);
-	if (fmt == NULL)
-		storage->error = NULL;
-	else {
+	mail_storage_clear_error(storage);
+	if (fmt != NULL) {
 		va_start(va, fmt);
 		i_error("%s", t_strdup_vprintf(fmt, va));
 		va_end(va);
@@ -284,9 +279,11 @@
 }
 
 const char *mail_storage_get_last_error(struct mail_storage *storage,
-					int *syntax_error_r)
+					int *syntax_error_r,
+					int *temporary_error_r)
 {
-	return storage->v.get_last_error(storage, syntax_error_r);
+	return storage->v.get_last_error(storage, syntax_error_r,
+					 temporary_error_r);
 }
 
 struct mailbox *mailbox_open(struct mail_storage *storage, const char *name,

Index: mail-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- mail-storage.h	12 Jul 2005 13:40:10 -0000	1.96
+++ mail-storage.h	29 Jul 2005 08:43:04 -0000	1.97
@@ -284,7 +284,8 @@
 
 /* Returns the error message of last occured error. */
 const char *mail_storage_get_last_error(struct mail_storage *storage,
-					int *syntax_error_r);
+					int *syntax_error_r,
+					int *temporary_error_r);
 
 /* Open a mailbox. If input stream is given, mailbox is opened read-only
    using it as a backend. If storage doesn't support stream backends and its



More information about the dovecot-cvs mailing list