mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 20:56:51 +00:00
Send unilateral responses before sending OK
This commit is contained in:
@ -27,7 +27,6 @@ import (
|
||||
"github.com/ProtonMail/proton-bridge/internal/users/credentials"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
imapBackend "github.com/emersion/go-imap/backend"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -43,8 +42,6 @@ type User struct {
|
||||
clientManager ClientManager
|
||||
credStorer CredentialsStorer
|
||||
|
||||
imapUpdatesChannel chan imapBackend.Update
|
||||
|
||||
storeFactory StoreMaker
|
||||
store *store.Store
|
||||
|
||||
@ -95,7 +92,7 @@ func (u *User) client() pmapi.Client {
|
||||
// have the apitoken and password), authorising the user against the api, loading the user store (creating a new one
|
||||
// if necessary), and setting the imap idle updates channel (used to send imap idle updates to the imap backend if
|
||||
// something in the store changed).
|
||||
func (u *User) init(idleUpdates chan imapBackend.Update) (err error) {
|
||||
func (u *User) init() (err error) {
|
||||
u.log.Info("Initialising user")
|
||||
|
||||
// Reload the user's credentials (if they log out and back in we need the new
|
||||
@ -134,20 +131,9 @@ func (u *User) init(idleUpdates chan imapBackend.Update) (err error) {
|
||||
}
|
||||
u.store = store
|
||||
|
||||
// Save the imap updates channel here so it can be set later when imap connects.
|
||||
u.imapUpdatesChannel = idleUpdates
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (u *User) SetIMAPIdleUpdateChannel() {
|
||||
if u.store == nil {
|
||||
return
|
||||
}
|
||||
|
||||
u.store.SetIMAPUpdateChannel(u.imapUpdatesChannel)
|
||||
}
|
||||
|
||||
// authorizeIfNecessary checks whether user is logged in and is connected to api auth channel.
|
||||
// If user is not already connected to the api auth channel (for example there was no internet during start),
|
||||
// it tries to connect it.
|
||||
@ -539,7 +525,7 @@ func (u *User) CloseAllConnections() {
|
||||
}
|
||||
|
||||
if u.store != nil {
|
||||
u.store.SetIMAPUpdateChannel(nil)
|
||||
u.store.SetChangeNotifier(nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user