wasm-demo/demo/ermis-f/imap-protocol/cur/1600095040.22729.mbox:2,S

40 lines
1.7 KiB
Plaintext

MBOX-Line: From tss at iki.fi Wed May 2 14:28:46 2012
To: imap-protocol@u.washington.edu
From: Timo Sirainen <tss@iki.fi>
Date: Fri Jun 8 12:34:48 2018
Subject: [Imap-protocol] Concurrent flag changes
Message-ID: <14DB8F84-E3D5-426A-BBF6-5B4746B6E3DF@iki.fi>
I don't think IMAP RFCs actually require any specific behavior for this, so this is more of a "any recommendations?" type of a question:
Clients C1 and C2 send:
C1: a FETCH 1 FLAGS
S1: * 1 FETCH (FLAGS (\Seen \Answered))
S1: a OK
C2: b STORE 1 +FLAGS (\Flagged)
S2: * 1 FETCH (FLAGS (\Seen \Flagged))
S2: b OK
At this point C1 still thinks that 1's flags are (\Seen), and being a little bit stupid it unsets the \Seen flag by sending:
C1: c STORE 1 FLAGS (\Answered)
Now, I think the possible replies are either of these:
S1: * 1 FETCH (FLAGS (\Answered))
S1: * 1 FETCH (FLAGS (\Answered \Flagged))
Dovecot currently sends the first reply, but I've started thinking that perhaps I should change it to the second one. The question is really: Should STORE FLAGS be thought of as
a) Reset all the flags that you have currently, whatever they are, and only set these flags.
or
b) Atomically add these flags I've listed, and remove those that I used to see previously in this session but aren't listed here.
In the case of actual IMAP clients doing this, this is probably almost irrelevant. But it becomes more relevant if you have two IMAP servers doing a 2-way mailbox synchronization after a possibly long disconnection, and the same message's flags are changed in both of them.
I haven't really looked at how many of the real world clients are using STORE FLAGS. For those I'd think b) is what they really intend to do. But are there perhaps some specialized clients / use cases assuming a)?