user

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: GPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const Gigabyte = 1024 * Megabyte
View Source
const Kilobyte = uint64(1024)
View Source
const Megabyte = 1024 * Kilobyte
View Source
const (
	SyncRetryCooldown = 20 * time.Second
)

Variables

View Source
var (
	ErrNoSuchAddress     = errors.New("no such address")
	ErrInvalidReturnPath = errors.New("invalid return path")
	ErrInvalidRecipient  = errors.New("invalid recipient")
	ErrMissingAddrKey    = errors.New("missing address key")
)
View Source
var (
	EventPeriod = 20 * time.Second // nolint:gochecknoglobals,revive
	EventJitter = 20 * time.Second // nolint:gochecknoglobals,revive
)
View Source
var ErrAddressDoesNotExist = errors.New("address does not exist")

Functions

This section is empty.

Types

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 *User) AutoconfigUsed(client string)

func (*User) BadEventFeedbackResync added in v3.0.20

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

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) CancelSyncAndEventPoll added in v3.0.20

func (user *User) CancelSyncAndEventPoll()

CancelSyncAndEventPoll stops the sync or event poll go-routine.

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) ClearSyncStatus added in v3.0.12

func (user *User) ClearSyncStatus() error

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

func (user *User) GetAddressMode() vault.AddressMode

GetAddressMode returns the user's current address mode.

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) GetSyncStatus added in v3.0.14

func (user *User) GetSyncStatus() vault.SyncStatus

GetSyncStatus returns the sync status of the user.

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) KBArticleOpened added in v3.3.1

func (user *User) KBArticleOpened(article string)

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() int

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

func (user *User) NewIMAPConnector(addrID string) connector.Connector

NewIMAPConnector returns an IMAP connector for the given address. If not in split mode, this must be the primary address.

func (*User) NewIMAPConnectors

func (user *User) NewIMAPConnectors() (map[string]connector.Connector, error)

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

func (user *User) OnStatusDown(context.Context)

OnStatusDown is called when the connection goes down.

func (*User) OnStatusUp

func (user *User) OnStatusUp(context.Context)

OnStatusUp is called when the connection goes up.

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

func (user *User) SendMail(authID string, from string, to []string, r io.Reader) error

SendMail sends an email from the given address to the given recipients.

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(_ 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) TriggerSync added in v3.0.14

func (user *User) TriggerSync()

func (*User) UsedSpace

func (user *User) UsedSpace() int

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