[dovecot-cvs] dovecot/src/plugins/trash trash-plugin.c,1.19,1.20

tss at dovecot.org tss at dovecot.org
Thu Feb 22 15:38:46 UTC 2007


Update of /var/lib/cvs/dovecot/src/plugins/trash
In directory talvi:/tmp/cvs-serv17784

Modified Files:
	trash-plugin.c 
Log Message:
Fixes for handling multiple storages.



Index: trash-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/trash/trash-plugin.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- trash-plugin.c	22 Feb 2007 15:03:46 -0000	1.19
+++ trash-plugin.c	22 Feb 2007 15:38:43 -0000	1.20
@@ -57,7 +57,7 @@
 	trash->box = mailbox_open(trash->storage, trash->name, NULL,
 				  MAILBOX_OPEN_KEEP_RECENT);
 	if (trash->box == NULL)
-		return -1;
+		return 0;
 
 	if (sync_mailbox(trash->box) < 0)
 		return -1;
@@ -83,9 +83,10 @@
 		else
 			ret = mailbox_search_next(trash->search_ctx,
 						  trash->mail);
-		if (ret <= 0)
+		if (ret <= 0) {
+			*received_time_r = 0;
 			return ret;
-
+		}
 		trash->mail_set = TRUE;
 	}
 
@@ -104,14 +105,6 @@
 
 	trashes = array_get_modifiable(&trash_boxes, &count);
 	for (i = 0; i < count; ) {
-		if (trashes[i].storage == NULL) {
-			/* FIXME: this is really ugly. it'll do however until
-			   we get proper namespace support for lib-storage. */
-			struct mail_storage *const *storage;
-
-			storage = array_idx(&quota_set->storages, 0);
-			trashes[i].storage = *storage;
-		}
 		/* expunge oldest mails first in all trash boxes with
 		   same priority */
 		oldest_idx = count;
@@ -120,13 +113,22 @@
 			if (trashes[j].priority != trashes[j].priority)
 				break;
 
-			ret = trash_clean_mailbox_get_next(&trashes[i],
+			if (trashes[j].storage == NULL) {
+				/* FIXME: this is really ugly. it'll do however
+				   until we get proper namespace support for
+				   lib-storage. */
+				struct mail_storage *const *storage;
+
+				storage = array_idx(&quota_set->storages, 0);
+				trashes[j].storage = *storage;
+			}
+
+			ret = trash_clean_mailbox_get_next(&trashes[j],
 							   &received);
 			if (ret < 0)
 				goto __err;
 			if (ret > 0) {
-				if (oldest == (time_t)-1 ||
-				    received < oldest) {
+				if (oldest == (time_t)-1 || received < oldest) {
 					oldest = received;
 					oldest_idx = j;
 				}



More information about the dovecot-cvs mailing list