user

package
v3.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: GPL-3.0 Imports: 44 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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,
	telemetryManager telemetry.Availability,
	imapServerManager imapservice.IMAPServerManager,
	smtpServerManager smtp.ServerManager,
	eventSubscription events.Subscription,
	syncService syncservice.Regulator,
	observabilityService *observability.Service,
	syncConfigDir string,
	isNew bool,
	notificationStore *notifications.Store,
	getFlagValFn unleash.GetFlagValueFn,
) (*User, error)

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) 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) GetUserPlanName added in v3.16.0

func (user *User) GetUserPlanName() string

GetUserPlanName returns the user's subscription plan name.

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, withData, withDataDisabledKillSwitch 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) ResumeEventLoop added in v3.5.0

func (user *User) ResumeEventLoop()

func (*User) SendRepairDeferredTrigger added in v3.12.0

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

func (*User) SendRepairTrigger added in v3.12.0

func (user *User) SendRepairTrigger(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) TriggerRepair added in v3.12.0

func (user *User) TriggerRepair() error

func (*User) UsedSpace

func (user *User) UsedSpace() uint64

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

func (*User) VerifyResyncAndExecute added in v3.12.0

func (user *User) VerifyResyncAndExecute()

Jump to

Keyboard shortcuts

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