[PATCH] Rescan error after deleting an IMAP mailbox



Deleting an IMAP mailbox can make a chain of folders go away. For instance,
if you create a mailbox INBOX.a.a.a when INBOX.a doesn't exist, folders
INBOX.a and INBOX.a.a appear in the tree, as well as the mailbox
INBOX.a.a.a. If you then delete the mailbox, the chain of folders goes away
(at least, on my Cyrus server), so the tree should be rescanned all the way
from INBOX. The current code doesn't do that, so the folders are still
shown, even though the server has effectively deleted them. This small
patch (against today's CVS tree) fixes it.

	* src/mailbox-conf.c: rescan from higher up the tree after deleting
an IMAP mailbox.
diff -Nur balsa-cvs/src/mailbox-conf.c balsa-temp/src/mailbox-conf.c
--- balsa-cvs/src/mailbox-conf.c	Sun Aug 12 13:47:47 2001
+++ balsa-temp/src/mailbox-conf.c	Mon Aug 13 11:13:21 2001
@@ -224,6 +224,11 @@
     if (LIBBALSA_IS_MAILBOX_IMAP(mailbox) && !mailbox->config_prefix) {
 	BalsaMailboxNode *parent = mbnode->parent;
 	libbalsa_imap_delete_folder(LIBBALSA_MAILBOX_IMAP(mailbox));
+	/* a chain of folders might go away, so we'd better rescan from
+	 * higher up
+	 */
+	while (!parent->mailbox && parent->parent)
+		parent = parent->parent;
 	balsa_mailbox_node_rescan(parent); /* see it as server sees it */
 	return;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]