mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:44:35 +03:00
update modseq when changing mailbox/server metadata, and also for specialuse changes, and keep track of modseq for mailboxes
i added the metadata extension to the imapserver recently. then i wondered how a client would efficiently find changed metadata. turns out the qresync rfc mentions that metadata changes should set a new modseq on the mailbox. shouldn't be hard, except that we were not explicitly keeping track of modseqs per mailbox. we only kept them for messages, and we were just looking up the latest message modseq when we needed the modseq (we keep db entries for expunged messages, so this worked out fine). that approach isn't enough anymore. so know we keep track of modseq & createseq for mailboxes, just as for messages. and we also track modseq/createseq for annotations. there's a good chance jmap is going to need it. this also adds consistency checks for modseq/createseq on mailboxes and annotations to the account storage. it helped spot cases i missed where the values need to be updated.
This commit is contained in:
@ -61,12 +61,14 @@ type ChangeThread struct {
|
||||
type ChangeRemoveMailbox struct {
|
||||
MailboxID int64
|
||||
Name string
|
||||
ModSeq ModSeq
|
||||
}
|
||||
|
||||
// ChangeAddMailbox is sent for a newly created mailbox.
|
||||
type ChangeAddMailbox struct {
|
||||
Mailbox Mailbox
|
||||
Flags []string // For flags like \Subscribed.
|
||||
ModSeq ModSeq
|
||||
}
|
||||
|
||||
// ChangeRenameMailbox is sent for a rename mailbox.
|
||||
@ -75,6 +77,7 @@ type ChangeRenameMailbox struct {
|
||||
OldName string
|
||||
NewName string
|
||||
Flags []string
|
||||
ModSeq ModSeq
|
||||
}
|
||||
|
||||
// ChangeAddSubscription is sent for an added subscription to a mailbox.
|
||||
@ -95,6 +98,7 @@ type ChangeMailboxSpecialUse struct {
|
||||
MailboxID int64
|
||||
MailboxName string
|
||||
SpecialUse SpecialUse
|
||||
ModSeq ModSeq
|
||||
}
|
||||
|
||||
// ChangeMailboxKeywords is sent when keywords are changed for a mailbox. For
|
||||
@ -111,6 +115,7 @@ type ChangeAnnotation struct {
|
||||
MailboxID int64 // Can be zero, meaning global (per-account) annotation.
|
||||
MailboxName string // Empty for global (per-account) annotation.
|
||||
Key string // Also called "entry name", e.g. "/private/comment".
|
||||
ModSeq ModSeq
|
||||
}
|
||||
|
||||
var switchboardBusy atomic.Bool
|
||||
|
Reference in New Issue
Block a user