mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 13:16:53 +00:00
GODT-1779: Remove go-imap
This commit is contained in:
13
internal/events/connection.go
Normal file
13
internal/events/connection.go
Normal file
@ -0,0 +1,13 @@
|
||||
package events
|
||||
|
||||
import "gitlab.protontech.ch/go/liteapi"
|
||||
|
||||
type TLSIssue struct {
|
||||
eventBase
|
||||
}
|
||||
|
||||
type ConnStatus struct {
|
||||
eventBase
|
||||
|
||||
Status liteapi.Status
|
||||
}
|
||||
7
internal/events/error.go
Normal file
7
internal/events/error.go
Normal file
@ -0,0 +1,7 @@
|
||||
package events
|
||||
|
||||
type Error struct {
|
||||
eventBase
|
||||
|
||||
Error error
|
||||
}
|
||||
@ -1,60 +1,9 @@
|
||||
// Copyright (c) 2022 Proton AG
|
||||
//
|
||||
// This file is part of Proton Mail Bridge.
|
||||
//
|
||||
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// Package events provides names of events used by the event listener in bridge.
|
||||
package events
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||
)
|
||||
|
||||
// Constants of events used by the event listener in bridge.
|
||||
const (
|
||||
ErrorEvent = "error"
|
||||
CredentialsErrorEvent = "credentialsError"
|
||||
CloseConnectionEvent = "closeConnection"
|
||||
LogoutEvent = "logout"
|
||||
AddressChangedEvent = "addressChanged"
|
||||
AddressChangedLogoutEvent = "addressChangedLogout"
|
||||
UserRefreshEvent = "userRefresh"
|
||||
RestartBridgeEvent = "restartBridge"
|
||||
InternetConnChangedEvent = "internetChanged"
|
||||
InternetOff = "internetOff"
|
||||
InternetOn = "internetOn"
|
||||
SecondInstanceEvent = "secondInstance"
|
||||
NoActiveKeyForRecipientEvent = "noActiveKeyForRecipient"
|
||||
UpgradeApplicationEvent = "upgradeApplication"
|
||||
TLSCertIssue = "tlsCertPinningIssue"
|
||||
UserChangeDone = "QMLUserChangedDone"
|
||||
|
||||
// LogoutEventTimeout is the minimum time to permit between logout events being sent.
|
||||
LogoutEventTimeout = 3 * time.Minute
|
||||
)
|
||||
|
||||
// SetupEvents specific to event type and data.
|
||||
func SetupEvents(listener listener.Listener) {
|
||||
listener.SetLimit(LogoutEvent, LogoutEventTimeout)
|
||||
listener.SetBuffer(ErrorEvent)
|
||||
listener.SetBuffer(CredentialsErrorEvent)
|
||||
listener.SetBuffer(InternetConnChangedEvent)
|
||||
listener.SetBuffer(UpgradeApplicationEvent)
|
||||
listener.SetBuffer(TLSCertIssue)
|
||||
listener.SetBuffer(UserRefreshEvent)
|
||||
listener.Book(UserChangeDone)
|
||||
type Event interface {
|
||||
_isEvent()
|
||||
}
|
||||
|
||||
type eventBase struct{}
|
||||
|
||||
func (eventBase) _isEvent() {}
|
||||
|
||||
5
internal/events/raise.go
Normal file
5
internal/events/raise.go
Normal file
@ -0,0 +1,5 @@
|
||||
package events
|
||||
|
||||
type Raise struct {
|
||||
eventBase
|
||||
}
|
||||
24
internal/events/sync.go
Normal file
24
internal/events/sync.go
Normal file
@ -0,0 +1,24 @@
|
||||
package events
|
||||
|
||||
import "time"
|
||||
|
||||
type SyncStarted struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
}
|
||||
|
||||
type SyncProgress struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
Progress float64
|
||||
Elapsed time.Duration
|
||||
Remaining time.Duration
|
||||
}
|
||||
|
||||
type SyncFinished struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
}
|
||||
25
internal/events/update.go
Normal file
25
internal/events/update.go
Normal file
@ -0,0 +1,25 @@
|
||||
package events
|
||||
|
||||
import "github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||
|
||||
type UpdateAvailable struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
|
||||
CanInstall bool
|
||||
}
|
||||
|
||||
type UpdateNotAvailable struct {
|
||||
eventBase
|
||||
}
|
||||
|
||||
type UpdateInstalled struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
}
|
||||
|
||||
type UpdateForced struct {
|
||||
eventBase
|
||||
}
|
||||
52
internal/events/user.go
Normal file
52
internal/events/user.go
Normal file
@ -0,0 +1,52 @@
|
||||
package events
|
||||
|
||||
type UserLoggedIn struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
}
|
||||
|
||||
type UserLoggedOut struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
}
|
||||
|
||||
type UserDeauth struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
}
|
||||
|
||||
type UserDeleted struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
}
|
||||
|
||||
type UserChanged struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
}
|
||||
|
||||
type UserAddressCreated struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
Address string
|
||||
}
|
||||
|
||||
type UserAddressChanged struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
Address string
|
||||
}
|
||||
|
||||
type UserAddressDeleted struct {
|
||||
eventBase
|
||||
|
||||
UserID string
|
||||
Address string
|
||||
}
|
||||
Reference in New Issue
Block a user