mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-23 18:36:46 +00:00
Updates() needs to return imapBackend.Update instead of interface with go-imap v1
This commit is contained in:
@ -29,7 +29,7 @@ import (
|
||||
|
||||
// SetIMAPUpdateChannel sets the channel on which imap update messages will be sent. This should be the channel
|
||||
// on which the imap backend listens for imap updates.
|
||||
func (store *Store) SetIMAPUpdateChannel(updates chan interface{}) {
|
||||
func (store *Store) SetIMAPUpdateChannel(updates chan imapBackend.Update) {
|
||||
store.log.Debug("Listening for IMAP updates")
|
||||
|
||||
if store.imapUpdates = updates; store.imapUpdates == nil {
|
||||
@ -107,7 +107,7 @@ func (store *Store) imapMailboxStatus(address, mailboxName string, total, unread
|
||||
store.imapSendUpdate(update)
|
||||
}
|
||||
|
||||
func (store *Store) imapSendUpdate(update interface{}) {
|
||||
func (store *Store) imapSendUpdate(update imapBackend.Update) {
|
||||
if store.imapUpdates == nil {
|
||||
store.log.Trace("IMAP IDLE unavailable")
|
||||
return
|
||||
|
||||
@ -29,7 +29,7 @@ func TestCreateOrUpdateMessageIMAPUpdates(t *testing.T) {
|
||||
m, clear := initMocks(t)
|
||||
defer clear()
|
||||
|
||||
updates := make(chan interface{})
|
||||
updates := make(chan imapBackend.Update)
|
||||
|
||||
m.newStoreNoEvents(true)
|
||||
m.store.SetIMAPUpdateChannel(updates)
|
||||
@ -49,7 +49,7 @@ func TestCreateOrUpdateMessageIMAPUpdatesBulkUpdate(t *testing.T) {
|
||||
m, clear := initMocks(t)
|
||||
defer clear()
|
||||
|
||||
updates := make(chan interface{})
|
||||
updates := make(chan imapBackend.Update)
|
||||
|
||||
m.newStoreNoEvents(true)
|
||||
m.store.SetIMAPUpdateChannel(updates)
|
||||
@ -75,7 +75,7 @@ func TestDeleteMessageIMAPUpdate(t *testing.T) {
|
||||
insertMessage(t, m, "msg1", "Test message 1", addrID1, 0, []string{pmapi.AllMailLabel})
|
||||
insertMessage(t, m, "msg2", "Test message 2", addrID1, 0, []string{pmapi.AllMailLabel})
|
||||
|
||||
updates := make(chan interface{})
|
||||
updates := make(chan imapBackend.Update)
|
||||
m.store.SetIMAPUpdateChannel(updates)
|
||||
go checkIMAPUpdates(t, updates, []func(interface{}) bool{
|
||||
checkMessageDelete(addr1, "All Mail", 2),
|
||||
@ -87,7 +87,7 @@ func TestDeleteMessageIMAPUpdate(t *testing.T) {
|
||||
close(updates)
|
||||
}
|
||||
|
||||
func checkIMAPUpdates(t *testing.T, updates chan interface{}, checkFunctions []func(interface{}) bool) {
|
||||
func checkIMAPUpdates(t *testing.T, updates chan imapBackend.Update, checkFunctions []func(interface{}) bool) {
|
||||
idx := 0
|
||||
for update := range updates {
|
||||
if idx >= len(checkFunctions) {
|
||||
|
||||
@ -26,6 +26,7 @@ import (
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
imapBackend "github.com/emersion/go-imap/backend"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -101,7 +102,7 @@ type Store struct {
|
||||
db *bolt.DB
|
||||
lock *sync.RWMutex
|
||||
addresses map[string]*Address
|
||||
imapUpdates chan interface{}
|
||||
imapUpdates chan imapBackend.Update
|
||||
|
||||
isSyncRunning bool
|
||||
addressMode addressMode
|
||||
|
||||
Reference in New Issue
Block a user