Documentation
¶
Index ¶
- Constants
- Variables
- type AccountMailboxMap
- type DiagMailboxMessage
- type DiagnosticMetadata
- type MessageDownloader
- type SyncDownloadCache
- func (s *SyncDownloadCache) Clear()
- func (s *SyncDownloadCache) DeleteAttachments(id ...string)
- func (s *SyncDownloadCache) DeleteMessages(id ...string)
- func (s *SyncDownloadCache) GetAttachment(id string) ([]byte, bool)
- func (s *SyncDownloadCache) GetMessage(id string) (proton.Message, bool)
- func (s *SyncDownloadCache) StoreAttachment(id string, data []byte)
- func (s *SyncDownloadCache) StoreMessage(message proton.Message)
- type User
- func (user *User) AutoconfigUsed(client string)
- func (user *User) BadEventFeedbackResync(ctx context.Context)
- func (user *User) BridgePass() []byte
- func (user *User) CancelSyncAndEventPoll()
- func (user *User) CheckAuth(email string, password []byte) (string, error)
- func (user *User) ClearSyncStatus() error
- func (user *User) Close()
- func (user *User) DebugDownloadMessages(ctx context.Context, path string, msgs map[string]DiagMailboxMessage, ...) error
- func (user *User) Emails() []string
- func (user *User) GetAddressMode() vault.AddressMode
- func (user *User) GetDiagnosticMetadata(ctx context.Context) (DiagnosticMetadata, error)
- func (user *User) GetEventCh() <-chan events.Event
- func (user *User) GetGluonID(addrID string) (string, bool)
- func (user *User) GetGluonIDs() map[string]string
- func (user *User) GetSyncStatus() vault.SyncStatus
- func (user *User) GluonKey() []byte
- func (user *User) ID() string
- func (user *User) IsTelemetryEnabled(ctx context.Context) bool
- func (user *User) KBArticleOpened(article string)
- func (user *User) Logout(ctx context.Context, withAPI bool) error
- func (user *User) Match(query string) bool
- func (user *User) MaxSpace() int
- func (user *User) Name() string
- func (user *User) NewIMAPConnector(addrID string) connector.Connector
- func (user *User) NewIMAPConnectors() (map[string]connector.Connector, error)
- func (user *User) OnStatusDown(context.Context)
- func (user *User) OnStatusUp(context.Context)
- func (user *User) RemoveGluonID(addrID, gluonID string) error
- func (user *User) ReportBugClicked()
- func (user *User) ReportBugSent()
- func (user *User) ReportConfigStatusFailure(errDetails string)
- func (user *User) SendConfigStatusAbort(ctx context.Context, withTelemetry bool)
- func (user *User) SendConfigStatusProgress(ctx context.Context)
- func (user *User) SendConfigStatusRecovery(ctx context.Context)
- func (user *User) SendConfigStatusSuccess(ctx context.Context)
- func (user *User) SendMail(authID string, from string, to []string, r io.Reader) error
- func (user *User) SendTelemetry(ctx context.Context, data []byte) error
- func (user *User) SetAddressMode(_ context.Context, mode vault.AddressMode) error
- func (user *User) SetGluonID(addrID, gluonID string) error
- func (user *User) SetShowAllMail(show bool)
- func (user *User) TriggerSync()
- func (user *User) UsedSpace() int
Constants ¶
const Gigabyte = 1024 * Megabyte
const Kilobyte = uint64(1024)
const Megabyte = 1024 * Kilobyte
const SyncRetryCooldown = 20 * time.Second
Variables ¶
var ( ErrNoSuchAddress = errors.New("no such address") ErrInvalidReturnPath = errors.New("invalid return path") ErrInvalidRecipient = errors.New("invalid recipient") ErrMissingAddrKey = errors.New("missing address key") )
var ( EventPeriod = 20 * time.Second // nolint:gochecknoglobals,revive EventJitter = 20 * time.Second // nolint:gochecknoglobals,revive )
var ErrAddressDoesNotExist = errors.New("address does not exist")
Functions ¶
This section is empty.
Types ¶
type AccountMailboxMap ¶ added in v3.4.0
type AccountMailboxMap map[string][]DiagMailboxMessage
type DiagMailboxMessage ¶ added in v3.4.0
type DiagnosticMetadata ¶ added in v3.4.0
type DiagnosticMetadata struct { MessageIDs []string Metadata []proton.MessageMetadata FailedMessageIDs xmaps.Set[string] }
func (DiagnosticMetadata) BuildMailboxToMessageMap ¶ added in v3.4.0
func (apm DiagnosticMetadata) BuildMailboxToMessageMap(user *User) (map[string]AccountMailboxMap, error)
type MessageDownloader ¶ added in v3.4.0
type SyncDownloadCache ¶ added in v3.4.0
type SyncDownloadCache struct {
// contains filtered or unexported fields
}
func (*SyncDownloadCache) Clear ¶ added in v3.4.0
func (s *SyncDownloadCache) Clear()
func (*SyncDownloadCache) DeleteAttachments ¶ added in v3.4.0
func (s *SyncDownloadCache) DeleteAttachments(id ...string)
func (*SyncDownloadCache) DeleteMessages ¶ added in v3.4.0
func (s *SyncDownloadCache) DeleteMessages(id ...string)
func (*SyncDownloadCache) GetAttachment ¶ added in v3.4.0
func (s *SyncDownloadCache) GetAttachment(id string) ([]byte, bool)
func (*SyncDownloadCache) GetMessage ¶ added in v3.4.0
func (s *SyncDownloadCache) GetMessage(id string) (proton.Message, bool)
func (*SyncDownloadCache) StoreAttachment ¶ added in v3.4.0
func (s *SyncDownloadCache) StoreAttachment(id string, data []byte)
func (*SyncDownloadCache) StoreMessage ¶ added in v3.4.0
func (s *SyncDownloadCache) StoreMessage(message proton.Message)
type User ¶
type User struct {
// contains filtered or unexported fields
}
func New ¶
func New( ctx context.Context, encVault *vault.User, client *proton.Client, reporter reporter.Reporter, apiUser proton.User, crashHandler async.PanicHandler, showAllMail bool, maxSyncMemory uint64, statsDir string, telemetryManager telemetry.Availability, ) (*User, error)
New returns a new user.
func (*User) AutoconfigUsed ¶ added in v3.3.1
func (*User) BadEventFeedbackResync ¶ added in v3.0.20
BadEventFeedbackResync sends user feedback whether should do message re-sync.
func (*User) BridgePass ¶
BridgePass returns the user's bridge password, used for authentication over SMTP and IMAP.
func (*User) CancelSyncAndEventPoll ¶ added in v3.0.20
func (user *User) CancelSyncAndEventPoll()
CancelSyncAndEventPoll stops the sync or event poll go-routine.
func (*User) CheckAuth ¶
CheckAuth returns whether the given email and password can be used to authenticate over IMAP or SMTP with this user. It returns the address ID of the authenticated address.
func (*User) ClearSyncStatus ¶ added in v3.0.12
ClearSyncStatus clears the sync status of the user. This also drops any updates in the update channel(s). Warning: the gluon user must be removed and re-added if this happens!
func (*User) Close ¶
func (user *User) Close()
Close closes ongoing connections and cleans up resources.
func (*User) DebugDownloadMessages ¶ added in v3.4.0
func (*User) Emails ¶
Emails returns all the user's active email addresses. It returns them in sorted order; the user's primary address is first.
func (*User) GetAddressMode ¶
func (user *User) GetAddressMode() vault.AddressMode
GetAddressMode returns the user's current address mode.
func (*User) GetDiagnosticMetadata ¶ added in v3.4.0
func (user *User) GetDiagnosticMetadata(ctx context.Context) (DiagnosticMetadata, error)
func (*User) GetEventCh ¶
GetEventCh returns a channel which notifies of events happening to the user (such as deauth, address change).
func (*User) GetGluonID ¶
GetGluonID returns the gluon ID for the given address, if present.
func (*User) GetGluonIDs ¶
GetGluonIDs returns the users gluon IDs.
func (*User) GetSyncStatus ¶ added in v3.0.14
func (user *User) GetSyncStatus() vault.SyncStatus
GetSyncStatus returns the sync status of the user.
func (*User) IsTelemetryEnabled ¶ added in v3.2.0
IsTelemetryEnabled check if the telemetry is enabled or disabled for this user.
func (*User) KBArticleOpened ¶ added in v3.3.1
func (*User) NewIMAPConnector ¶
NewIMAPConnector returns an IMAP connector for the given address. If not in split mode, this must be the primary address.
func (*User) NewIMAPConnectors ¶
NewIMAPConnectors returns IMAP connectors for each of the user's addresses. In combined mode, this is just the user's primary address. In split mode, this is all the user's addresses.
func (*User) OnStatusDown ¶
OnStatusDown is called when the connection goes down.
func (*User) OnStatusUp ¶
OnStatusUp is called when the connection goes up.
func (*User) RemoveGluonID ¶
RemoveGluonID removes the gluon ID for the given address.
func (*User) ReportBugClicked ¶ added in v3.3.1
func (user *User) ReportBugClicked()
func (*User) ReportBugSent ¶ added in v3.3.1
func (user *User) ReportBugSent()
func (*User) ReportConfigStatusFailure ¶ added in v3.3.1
func (*User) SendConfigStatusAbort ¶ added in v3.3.1
func (*User) SendConfigStatusProgress ¶ added in v3.3.1
func (*User) SendConfigStatusRecovery ¶ added in v3.3.1
func (*User) SendConfigStatusSuccess ¶ added in v3.3.1
func (*User) SendTelemetry ¶ added in v3.2.0
SendTelemetry send telemetry request.
func (*User) SetAddressMode ¶
SetAddressMode sets the user's address mode.
func (*User) SetGluonID ¶
SetGluonID sets the gluon ID for the given address.
func (*User) SetShowAllMail ¶
SetShowAllMail sets whether to show the All Mail mailbox.
func (*User) TriggerSync ¶ added in v3.0.14
func (user *User) TriggerSync()