[Bug+Fix] broken mailbox view after moving IMAP folder sideways

Albrecht Dreß <[email protected]>
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Hi all,

I noticed a bug when a folder on a IMAP server is moved sideways, e.g. from “INBOX/Folder1/Test” to “INBOX/Folder2/Test”: after moving, a partial re-scan of the mailbox tree is performed, which makes all my local folders disappear.  The effect does not occur if the folder is moved up or down the tree.  I could track down the source of the issue to src/folder-conf.c, function subfolder_conf_clicked_ok().

At least for me, the attached patch fixes the problem:  simply re-scan the whole IMAP server folder tree.  As moving folders around on an IMAP server is typically not a frequent operation, the performance penalty (if there is any) should be negligible.

We /might/ even consider to simplify the whole block starting at src/folder-conf.c, line 566, to just re-scanning the whole server, but as I mentioned above, the other two use cases work fine for me.

Opinions?

Cheers,
Albrecht.

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
fix_move_imap_folder_sideways.diff (text/x-patch, 846 B)
diff --git a/src/folder-conf.c b/src/folder-conf.c
index 7937edb2c..fe20d7458 100644
--- a/src/folder-conf.c
+++ b/src/folder-conf.c
@@ -586,13 +586,12 @@ folder, parent);
 		    }
                 } else {
                     /* moved it sideways: a chain of folders might
-                     * go away, so we'd better rescan from higher up
+                     * go away, so we'd better rescan the complete IMAP server
                      */
                     BalsaMailboxNode *mb = sdd->mbnode->parent;
-                    while (!mb->mailbox && mb->parent)
+                    while ((mb->mailbox != NULL) && (mb->parent != NULL))
                         mb = mb->parent;
                     balsa_mailbox_node_rescan(mb);
-                    balsa_mailbox_node_rescan(sdd->mbnode);
                 }
             }
         }
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlyD1kEACgkQTKlvDmfn
2fg5pQf9EzSDgRmFRg8o8UfXKQGWXOD2zPR9Ax8gmmzKkcyEGEolldvikHG+Zxnr
aAYYWwaPG5/lhujME3ZMO6giJzyAOSsk0XIN+Y0+VdXS5w6COzHj34kT+TFofMBP
G9tYE3NeXq7DUOZmzp/xhYGlG2cefNN4xnhNx7eDEansw9PiswVa2wX1PDl3QBG/
aqdvpsh6fqJxi6cSzPgiWOaBG01Bgw1lEzlP9FUrw1J+0yjIKrMf/xePNx8oq2tI
wNf7FAu3GCJxdDtS+p3uRneDhAT+7GPz3avZ9oGpS8sVqnReFQjVazws27maat/O
m2mXyLPmW3iT0lkMD19ehhYD6F0egA==
=2Bw4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.