user

package
v3.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyncRetryCooldown = 20 * time.Second
)

Variables

View Source
var (
	ErrNoSuchAddress  = errors.New("no such address")
	ErrMissingAddrKey = errors.New("missing address key")
)
View Source
var (
	EventPeriod = 20 * time.Second // nolint:gochecknoglobals,revive
	EventJitter = 20 * time.Second // nolint:gochecknoglobals,revive
)

Functions

func TryBuildDebugMessage added in v3.7.0

func TryBuildDebugMessage(path string) error

Types

type AccountMailboxMap added in v3.4.0

type AccountMailboxMap map[string][]DiagMailboxMessage

type DebugMetadata added in v3.7.0

type DebugMetadata struct {
	proton.MessageMetadata
	Header        string
	ParsedHeaders proton.Headers
	MIMEType      rfc822.MIMEType
	Attachments   []proton.Attachment
}

type DiagMailboxMessage added in v3.4.0

type DiagMailboxMessage struct {
	AddressID string
	UserID    string
	ID        string
	Flags     imap.FlagSet
}

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(ctx context.Context, user *User) (map[string]AccountMailboxMap, error)

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,
	imapServerManager imapservice.IMAPServerManager,
	smtpServerManager smtp.ServerManager,
	eventSubscription events.Subscription,
	syncService syncservice.Regulator,
	syncConfigDir string,
	isNew bool,
) (*User, error)

func (*User) AutoconfigUsed added in v3.3.1

func (user *User) AutoconfigUsed(client string)

func (*User) BadEventFeedbackResync added in v3.0.20

func (user *User) BadEventFeedbackResync(ctx context.Context) error

BadEventFeedbackResync sends user feedback whether should do message re-sync.

func (*User) BridgePass

func (user *User) BridgePass() []byte

BridgePass returns the user's bridge password, used for authentication over SMTP and IMAP.

func (*User) CheckAuth

func (user *User) CheckAuth(email string, password []byte) (string, error)

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) Close

func (user *User) Close()

Close closes ongoing connections and cleans up resources.

func (*User) DebugDownloadMessages added in v3.4.0

func (user *User) DebugDownloadMessages(
	ctx context.Context,
	path string,
	msgs map[string]DiagMailboxMessage,
	progressCB func(string, int, int),
) error

func (*User) DisplayNames added in v3.7.1

func (user *User) DisplayNames() map[string]string

DisplayNames returns a map of the email addresses and their associated display names.

func (*User) Emails

func (user *User) Emails() []string

Emails returns all the user's active email addresses. It returns them in sorted order; the user's primary address is first.

func (*User) ExternalLinkClicked added in v3.8.0

func (user *User) ExternalLinkClicked(url string)

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

func (user *User) GetEventCh() <-chan events.Event

GetEventCh returns a channel which notifies of events happening to the user (such as deauth, address change).

func (*User) GetGluonID

func (user *User) GetGluonID(addrID string) (string, bool)

GetGluonID returns the gluon ID for the given address, if present.

func (*User) GetGluonIDs

func (user *User) GetGluonIDs() map[string]string

GetGluonIDs returns the users gluon IDs.

func (*User) GetSMTPService added in v3.5.0

func (user *User) GetSMTPService() *smtp.Service

func (*User) GluonKey

func (user *User) GluonKey() []byte

GluonKey returns the user's gluon key from the vault.

func (*User) ID

func (user *User) ID() string

ID returns the user's ID.

func (*User) IsTelemetryEnabled added in v3.2.0

func (user *User) IsTelemetryEnabled(ctx context.Context) bool

IsTelemetryEnabled check if the telemetry is enabled or disabled for this user.

func (*User) Logout

func (user *User) Logout(ctx context.Context, withAPI bool) error

Logout logs the user out from the API.

func (*User) Match

func (user *User) Match(query string) bool

Match matches the given query against the user's username and email addresses.

func (*User) MaxSpace

func (user *User) MaxSpace() uint64

MaxSpace returns the amount of space the user can use on the API.

func (*User) Name

func (user *User) Name() string

Name returns the user's username.

func (*User) OnBadEvent added in v3.5.0

func (user *User) OnBadEvent(ctx context.Context)

func (*User) PauseEventLoop added in v3.5.0

func (user *User) PauseEventLoop()

func (*User) PauseEventLoopWithWaiter added in v3.5.0

func (user *User) PauseEventLoopWithWaiter() *userevents.EventPollWaiter

func (*User) PublishEvent added in v3.5.0

func (user *User) PublishEvent(_ context.Context, event events.Event)

func (*User) RemoveGluonID

func (user *User) RemoveGluonID(addrID, gluonID string) error

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 *User) ReportConfigStatusFailure(errDetails string)

func (*User) ReportSMTPAuthFailed added in v3.5.0

func (user *User) ReportSMTPAuthFailed(username string)

func (*User) ReportSMTPAuthSuccess added in v3.5.0

func (user *User) ReportSMTPAuthSuccess(ctx context.Context)

func (*User) ResumeEventLoop added in v3.5.0

func (user *User) ResumeEventLoop()

func (*User) SendConfigStatusAbort added in v3.3.1

func (user *User) SendConfigStatusAbort(ctx context.Context, withTelemetry bool)

func (*User) SendConfigStatusProgress added in v3.3.1

func (user *User) SendConfigStatusProgress(ctx context.Context)

func (*User) SendConfigStatusRecovery added in v3.3.1

func (user *User) SendConfigStatusRecovery(ctx context.Context)

func (*User) SendConfigStatusSuccess added in v3.3.1

func (user *User) SendConfigStatusSuccess(ctx context.Context)

func (*User) SendTelemetry added in v3.2.0

func (user *User) SendTelemetry(ctx context.Context, data []byte) error

SendTelemetry send telemetry request.

func (*User) SetAddressMode

func (user *User) SetAddressMode(ctx context.Context, mode vault.AddressMode) error

SetAddressMode sets the user's address mode.

func (*User) SetGluonID

func (user *User) SetGluonID(addrID, gluonID string) error

SetGluonID sets the gluon ID for the given address.

func (*User) SetShowAllMail

func (user *User) SetShowAllMail(show bool)

SetShowAllMail sets whether to show the All Mail mailbox.

func (*User) UsedSpace

func (user *User) UsedSpace() uint64

UsedSpace returns the total space used by the user on the API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL