forked from Silverfish/proton-bridge
Do not send an EXISTS reposnse after EXPUNGE or when nothing changed
This commit is contained in:
committed by
Jakub Cuth
parent
a246a35cb7
commit
0cb1ff9b16
@ -8,6 +8,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
|
|||||||
* IMAP extension Unselect
|
* IMAP extension Unselect
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
* GODT-225 Do not send an EXISTS reposnse after EXPUNGE or when nothing changed (fixes rebuild of mailboxes in Outlook for Mac)
|
||||||
* GODT-165 Optimization of RebuildMailboxes
|
* GODT-165 Optimization of RebuildMailboxes
|
||||||
* Adding DSN Sentry as build time parameter
|
* Adding DSN Sentry as build time parameter
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const (
|
|||||||
appendSucess = "APPEND successful"
|
appendSucess = "APPEND successful"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logrus.WithField("pkg", "impa/uidplus") //nolint[gochecknoglobals]
|
var log = logrus.WithField("pkg", "imap/uidplus") //nolint[gochecknoglobals]
|
||||||
|
|
||||||
// OrderedSeq to remember Seq in order they are added.
|
// OrderedSeq to remember Seq in order they are added.
|
||||||
// We didn't find any restriction in RFC that server must respond with ranges
|
// We didn't find any restriction in RFC that server must respond with ranges
|
||||||
|
|||||||
@ -249,6 +249,8 @@ func (storeMailbox *Mailbox) txSkipAndRemoveFromMailbox(tx *bolt.Tx, msg *pmapi.
|
|||||||
|
|
||||||
// txCreateOrUpdateMessages will delete, create or update message from mailbox.
|
// txCreateOrUpdateMessages will delete, create or update message from mailbox.
|
||||||
func (storeMailbox *Mailbox) txCreateOrUpdateMessages(tx *bolt.Tx, msgs []*pmapi.Message) error { //nolint[funlen]
|
func (storeMailbox *Mailbox) txCreateOrUpdateMessages(tx *bolt.Tx, msgs []*pmapi.Message) error { //nolint[funlen]
|
||||||
|
shouldSendMailboxUpdate := false
|
||||||
|
|
||||||
// Buckets are not initialized right away because it's a heavy operation.
|
// Buckets are not initialized right away because it's a heavy operation.
|
||||||
// The best option is to get the same bucket only once and only when needed.
|
// The best option is to get the same bucket only once and only when needed.
|
||||||
var apiBucket, imapBucket *bolt.Bucket
|
var apiBucket, imapBucket *bolt.Bucket
|
||||||
@ -284,6 +286,7 @@ func (storeMailbox *Mailbox) txCreateOrUpdateMessages(tx *bolt.Tx, msgs []*pmapi
|
|||||||
seqNum,
|
seqNum,
|
||||||
msg,
|
msg,
|
||||||
)
|
)
|
||||||
|
shouldSendMailboxUpdate = true
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -317,9 +320,16 @@ func (storeMailbox *Mailbox) txCreateOrUpdateMessages(tx *bolt.Tx, msgs []*pmapi
|
|||||||
seqNum,
|
seqNum,
|
||||||
msg,
|
msg,
|
||||||
)
|
)
|
||||||
|
shouldSendMailboxUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return storeMailbox.txMailboxStatusUpdate(tx)
|
if shouldSendMailboxUpdate {
|
||||||
|
if err := storeMailbox.txMailboxStatusUpdate(tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// txDeleteMessage deletes the message from the mailbox bucket.
|
// txDeleteMessage deletes the message from the mailbox bucket.
|
||||||
@ -353,9 +363,10 @@ func (storeMailbox *Mailbox) txDeleteMessage(tx *bolt.Tx, apiID string) error {
|
|||||||
storeMailbox.labelName,
|
storeMailbox.labelName,
|
||||||
seqNum,
|
seqNum,
|
||||||
)
|
)
|
||||||
if err := storeMailbox.txMailboxStatusUpdate(tx); err != nil {
|
// Outlook for Mac has problems with sending an EXISTS after deleting
|
||||||
return err
|
// messages, mostly after moving message to other folder. It causes
|
||||||
}
|
// Outlook to rebuild the whole mailbox. [RFC-3501] says it's not
|
||||||
|
// necessary to send an EXISTS response with the new value.
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user