[Patch] Fix broken IMAP special folders & other migration issues

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

unfortunately, when I submitted the patch for moving single IMAP mailboxes to folders in august, I apparently did not test the migration process thoroughly…  Now the following issues popped up:

(1) If an IMAP folder has a special function (like Inbox), its LibBalsaMailboxImap mailbox definition must be kept in the config as it is destroyed otherwise.

(2) Less problematic: if more than one LibBalsaMailboxImap exists on the same server, for each of them a new IMAP folder definition is created.  It is trivial to erase the extra ones, but should not happen, of course.

Attached is a quick patch (I discovered the problem only today) which does the following:
- Add a "Migrated" flag to LibBalsaMailboxImap folder definitions to indicate that we already saw them.
- In the migration process, skip all folders having this flag.  Delete only LibBalsaMailboxImap folders which have no special meaning.
- Also during the migration process, track the folders already being migrated (as "user@host") to avoid the duplicates.

This sounds pretty much like a bad hack (and probably is), but makes Balsa usable again with special boxes on IMAP.  And, yes, this time I ran a lot of tests (no valgrind, i.e. not for leaks, though)…  However, any better idea is highly welcome – but it could be necessary to dig deep into the logic of special folders.

Sorry for any problem related to this,
best,
Albrecht.

---
Patch details:
- libbalsa/mailbox.[ch]: tell libbalsa_mailbox_new_from_config() if a folder is special, so it is processed even if it is an IMAP one
- libbalsa/mailbox_imap.c: always set the "Migrated" flag for LibBalsaMailboxImap mailboxes
- src/save-restore.c: in the migration process, track "user@host" folder ids in a hash table to avoid duplicates; keep special IMAP folders; load folders before mailboxes so special IMAP mailboxes do not overwrite the folder's IMAP configs (the server config originates from the first server seen)

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
fix_imap_special_folders.diff.bz2 (application/x-bzip, 2.2 KB) - not displayed
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlvguu4ACgkQTKlvDmfn
2fhv5wgAs+8HAgvnfjr1cwlmMXQQWMLHo3ZRXYsQPkhhRl+77VnuWaQHkiuxjY3F
kKquzuDp3uxHp5lN/eFYn+zWQlDbVKmcdZYROFTcAd2nHuxYW18NGexZ+BsQfFIb
/SoN071WVBgxhzo1oyNB0k2bLeRivC2jqLl8qFYIoyAnP1t5US/+Tl2kptJHj5j2
K8UFYyDfjYM1P+S7Ze+d5J5tWvVOOdKwyGk39X/4VB6TfNXAdn5luJGideF7RaU3
Ho43yLr/KKEQzlXKR6bqlmoeiXKD9Rmbw6+mFFG7Tn92sxkrtlaZnulHjg4gtLPm
V/xix+cSaj+BpOmV9X3mxypA4APc9Q==
=aeoX
-----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.