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



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)

Attachment: fix_imap_special_folders.diff.bz2
Description: application/bzip

Attachment: pgp2gyFhEPdsP.pgp
Description: PGP signature



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