mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
Mitigate Apple Mail re-sync (both bodies and meta info)
This commit is contained in:
@ -37,7 +37,7 @@ type panicHandler interface {
|
||||
type imapBackend struct {
|
||||
panicHandler panicHandler
|
||||
bridge bridger
|
||||
updates chan goIMAPBackend.Update
|
||||
updates *imapUpdates
|
||||
eventListener listener.Listener
|
||||
|
||||
users map[string]*imapUser
|
||||
@ -46,9 +46,6 @@ type imapBackend struct {
|
||||
imapCache map[string]map[string]string
|
||||
imapCachePath string
|
||||
imapCacheLock *sync.RWMutex
|
||||
|
||||
updatesBlocking map[string]bool
|
||||
updatesBlockingLocker sync.Locker
|
||||
}
|
||||
|
||||
// NewIMAPBackend returns struct implementing go-imap/backend interface.
|
||||
@ -75,7 +72,7 @@ func newIMAPBackend(
|
||||
return &imapBackend{
|
||||
panicHandler: panicHandler,
|
||||
bridge: bridge,
|
||||
updates: make(chan goIMAPBackend.Update),
|
||||
updates: newIMAPUpdates(),
|
||||
eventListener: eventListener,
|
||||
|
||||
users: map[string]*imapUser{},
|
||||
@ -83,9 +80,6 @@ func newIMAPBackend(
|
||||
|
||||
imapCachePath: cache.GetIMAPCachePath(),
|
||||
imapCacheLock: &sync.RWMutex{},
|
||||
|
||||
updatesBlocking: map[string]bool{},
|
||||
updatesBlockingLocker: &sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +166,7 @@ func (ib *imapBackend) Login(_ *imap.ConnInfo, username, password string) (goIMA
|
||||
// so that it doesn't make bridge slow for users who are only using bridge for SMTP
|
||||
// (otherwise the store will be locked for 1 sec per email during synchronization).
|
||||
if store := imapUser.user.GetStore(); store != nil {
|
||||
store.SetChangeNotifier(ib)
|
||||
store.SetChangeNotifier(ib.updates)
|
||||
}
|
||||
|
||||
return imapUser, nil
|
||||
@ -183,7 +177,7 @@ func (ib *imapBackend) Updates() <-chan goIMAPBackend.Update {
|
||||
// Called from go-imap in goroutines - we need to handle panics for each function.
|
||||
defer ib.panicHandler.HandlePanic()
|
||||
|
||||
return ib.updates
|
||||
return ib.updates.ch
|
||||
}
|
||||
|
||||
func (ib *imapBackend) CreateMessageLimit() *uint32 {
|
||||
|
||||
Reference in New Issue
Block a user