On May 1, 2008, at 3:23 PM, Ed W wrote:
- Sending updated flag/keyword changes can't be done in a standard
way, because it only shows the last flag+keyword state, not the changes
that were done (e.g. "\Seen" vs. "+\Seen -\Flagged").Hmm... I guess that can only be done anyway by storing the state
before and after and figuring out the changes based on a comparison?
Dovecot stores flag changes as "added flags" and "removed flags" in
transaction file, so it doesn't need to do any comparing to figure out
what had changed. This makes the flag changes also more reliable. For
example if a message originally had flags (\Flagged) and then two
servers changed them:
S1: STORE 1 +FLAGS \Answered S2: STORE 1 +FLAGS \Seen S2: STORE 1 -FLAGS \Flagged
If replication protocol sent the changes as +flags -flags, it would be
unambiguous what the final flags are: (\Answered \Seen).
If replication protocol instead sent the flags as their currently
known flag states (as IMAP protocol does):
S1: * 1 FLAGS (\Answered \Flagged) S2: * 1 FLAGS (\Seen)
There aren't any good ways to figure out what the wanted final flags
are supposed to be.
I do like the idea of making this more generic and hence hackable
than writing all the code into dovecot itself. Perhaps we could
start with an external proxy app at each end of the link which is
external to the imap server, ie basically start with IMAP sync.
That would work for the mailbox synchronization part, but I'm more
interested in the incremental synchronization part which replicates
all changes in all mailboxes immediately. That's not really possible
to base on an external proxy. Mostly because the IMAP protocol
supports seeing changes only in a single mailbox at a time, and trying
to change that would most likely make the protocol different enough
from IMAP that there's not much point in using IMAP as a base anymore.