Hi Erik, Finally got my head around this issue. > I believe there are 4 possible strategies for merging two sets of > keywords, set A and set B. Setting A to B, setting B to A, setting to > the union of A and B, or setting to the intersection of A and B. Yes! Union, that was what I tried to express by overlay. If you connect to an IMAP mailbox WL updates the flag folder with the union of flag folder and server flags. If C is the flag folder of the client and S is the server we can say: C <- S ∪ C Not removing flags in C if they are removed in S is therefor not a bug, but the intended behavior. > For user keywords, I think that WL should “trust IMAP” when keywords > are supported in the IMAP server. That is, WL should set the keywords > of a message in the msgdb to what IMAP says they are. This is the same > behavior that WL uses when messages are deleted or moved. If the IMAP > server does not support IMAP, then flags should of course be only > stored locally. Just to make the terminology clear: We are not talking about the message db, but another type of folder, the flag folder. The desired behavior here is C <- S This makes perfect sense for folders that support user defined keywords, i.e. IMAP. I've created a branch on Github https://github.com/dmj/wanderlust/tree/feature/sync-marks-s-to-c Where I factored out the merging into a separate generic function `elmo-folder-merge-flagged' and a default method with the current union merge. Now we can write a specialized method for IMAP folders and implement union -or- s-to-c depending on an IMAP specific configuration variable. A rough scetch. 1. Check if IMAP server supports permanent flags - implement a specialized method of `elmo-folder-list-flagged' for IMAP folders - check presence of \* in PERMANENTFLAGS -or- no PERMANENTFLAGS response (cf. RFC3501 6.3.1) - if no PERMANENTFLAGS, return the flag folder set - otherwise call parent implementation (call-next-method) 2. Sync the flags - check value of `elmo-imap4-sync-flag-method' - if 'union, use union - if 'server-to-client - if server list is empty but client is not, prompt - (k)eep :: do nothing, aka deal with it later - (l)ocal :: Sync c -> s - (r)emote :: Sync s -> c > I don’t know how WL handles updating flags after they are marked in > disconnected mode. I assume this works separately from the sync marks > mechanism. When disconnected WL creates an IMAP flag commend as disconnected operation and pushes it in the disconnected operations queue. If you go online again WL flushes the queue before marks are sync. Best, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de
Attachment:
pgpfsfM8QJ5ve.pgp
Description: PGP signature