Documentation
¶
Overview ¶
Package app is Godwit's desktop interface: one App whose view is rebuilt every frame from state that only the UI thread changes.
Index ¶
- Constants
- Variables
- func MenuIcon(name string) *mygo.MenuIcon
- func ReportURL(errText, logText string) string
- type App
- func (a *App) AccountLabels(accID int64) []core.Label
- func (a *App) BeforeClose(proceed func())
- func (a *App) BodyBuilt(view ui.NativeWebView, message int64, cut, remote bool)
- func (a *App) BodyFailed(view ui.NativeWebView, message int64, err error)
- func (a *App) BodyHeight(view ui.NativeWebView, message int64, px int)
- func (a *App) BodyImagesFailed(view ui.NativeWebView, message int64, n int)
- func (a *App) BodyLink(view ui.NativeWebView, link string)
- func (a *App) BodyNavigate(view ui.NativeWebView, dir int)
- func (a *App) BodyPainted(view ui.NativeWebView, message int64)
- func (a *App) BodyPrint(view ui.NativeWebView)
- func (a *App) BodySave(view ui.NativeWebView)
- func (a *App) BodySearch(view ui.NativeWebView)
- func (a *App) Busy() bool
- func (a *App) Close()
- func (a *App) Compose()
- func (a *App) ComposeView(f *ComposeFrame) func(*ui.Context)
- func (a *App) ComposeWindowsChanged()
- func (a *App) ConversationCreated(id, version int64)
- func (a *App) EditRule(r core.Rule, conv, approval int64, ask string)
- func (a *App) KeepInBackground() bool
- func (a *App) MailReady() bool
- func (a *App) Navigate(dir int)
- func (a *App) NewConversation()
- func (a *App) NotificationClicked(id string)
- func (a *App) OnUI(f func())
- func (a *App) Open(what string)
- func (a *App) OpenAbout()
- func (a *App) OpenDraft(id int64)
- func (a *App) OpenLink(link string)
- func (a *App) OpenMessage(id int64)
- func (a *App) OpenModels()
- func (a *App) OpenSettings()
- func (a *App) QuitCancelled()
- func (a *App) Search()
- func (a *App) SetForeground(on bool)
- func (a *App) SetWitAsk(ask func(query string, quoted ...core.MessageSummary))
- func (a *App) SetWitPage(view ui.NativeWebView, open, created func(conv int64) (version int64))
- func (a *App) SignatureHTML()
- func (a *App) SignatureLink(current string, answer func(url string, ok bool))
- func (a *App) Start(ctx context.Context)
- func (a *App) SyncAll()
- func (a *App) ToggleSidebar()
- func (a *App) TrayIconShown() bool
- func (a *App) View(c *ui.Context)
- func (a *App) WitOrigin() (x, y int)
- func (a *App) WitToast(kind, text string)
- func (a *App) WitToastBar(bar, field ui.Rect)
- type BodyGlassRect
- type Clock
- type ComposeFrame
- type Deps
- type MailNotifier
- type MailNotifierDeps
- type MailNotifierService
- type Notification
- type NotificationSink
- type OAuthFlow
- type Page
- type Platform
- type Route
- type Service
Constants ¶
const NotifyWait = time.Second
NotifyWait is how long new mail gathers per account before reading it for notifications.
const OpenWindow, OpenCompose = "window", "compose"
What Open opens besides a notification's subject: the main window, or a new compose window.
Variables ¶
var ErrLoginItemOff = errors.New("open at login is off in the system's settings")
ErrLoginItemOff is the platform's SetOpenAtLogin failing because the system keeps Godwit's login item off until the user allows it there, as macOS does with one the user turned off in Login Items (#875). It is the user's choice, not a fault to report.
var RecentLog = core.RecentLog
RecentLog keeps the log's last lines in memory, never on disk, for an error report to carry; the backend tees its log into it.
var Version = "dev"
Version is the app's version; cmd/godwit sets it from the packaged app.
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the interface's state. Every field is read and written on the UI thread.
func (*App) AccountLabels ¶ added in v1.21.0
AccountLabels returns the labels for an account, with count and unread for that account.
func (*App) BeforeClose ¶
func (a *App) BeforeClose(proceed func())
BeforeClose saves the signature page's edit and the settings' account fields, waits for every write in flight, then calls proceed: before the window closes or the App quits (compose windows have flushed their drafts by then, on their own). When a write fails, or they have not finished within flushWait, the window shows and asks whether to close anyway; writes that finish while it asks close after all.
func (*App) BodyBuilt ¶
func (a *App) BodyBuilt(view ui.NativeWebView, message int64, cut, remote bool)
BodyBuilt is told message's body as its page got it: whether it is only the start (ReaderBody.Cut), for the truncated notice, and has the remote images (Remote), which hides their notice.
func (*App) BodyFailed ¶
func (a *App) BodyFailed(view ui.NativeWebView, message int64, err error)
BodyFailed is told reading message's body with its remote images failed: the notice offers a retry.
func (*App) BodyHeight ¶
func (a *App) BodyHeight(view ui.NativeWebView, message int64, px int)
BodyHeight is told the height, in CSS pixels, of message's body as its page laid it out: its element takes it.
func (*App) BodyImagesFailed ¶ added in v1.16.0
func (a *App) BodyImagesFailed(view ui.NativeWebView, message int64, n int)
BodyImagesFailed is told n of message's images could not load: the notice offers a retry.
func (*App) BodyLink ¶
func (a *App) BodyLink(view ui.NativeWebView, link string)
BodyLink opens a link of a body's page as one of the native reader's: http(s) after the confirmation, mailto in a compose window.
func (*App) BodyNavigate ¶
func (a *App) BodyNavigate(view ui.NativeWebView, dir int)
BodyNavigate goes back or forward for a body's page (⌘[ and ⌘]).
func (*App) BodyPainted ¶ added in v1.40.2
func (a *App) BodyPainted(view ui.NativeWebView, message int64)
BodyPainted follows layout and a browser paint opportunity for this binding.
func (*App) BodyPrint ¶ added in v1.17.0
func (a *App) BodyPrint(view ui.NativeWebView)
BodyPrint prints the message of a body's page (⌘P).
func (*App) BodySave ¶ added in v1.17.0
func (a *App) BodySave(view ui.NativeWebView)
BodySave saves the message of a body's page (⌘S).
func (*App) BodySearch ¶
func (a *App) BodySearch(view ui.NativeWebView)
BodySearch opens the search palette for a body's page (⌘F, ⌘K).
func (*App) Busy ¶ added in v1.36.0
Busy reports whether work the user started runs in this process and ends with it: a model's or 识别模型's download, a local archive's import, an attachment's download. UI thread.
func (*App) Close ¶
func (a *App) Close()
Close cancels all work in flight, attachment downloads included, whose done callbacks never run, closes the reader's body pages and removes the temporary copies of opened attachments. UI thread.
func (*App) Compose ¶
func (a *App) Compose()
Compose starts a new draft in a compose window, as the sidebar's button does.
func (*App) ComposeView ¶ added in v1.39.4
func (a *App) ComposeView(f *ComposeFrame) func(*ui.Context)
ComposeView draws f: a compose window's title bar on the window's material, its page under it, and its toasts over both.
func (*App) ComposeWindowsChanged ¶
func (a *App) ComposeWindowsChanged()
ComposeWindowsChanged is told a compose window opened or went (on the UI thread): the drafts list is read again, and the pane follows its draft.
func (*App) ConversationCreated ¶
ConversationCreated is told the Wit page's first question made conversation id, under snapshot version: while the route still shows that version's new conversation it takes id in place (back and forward keep it), and the page is told it as a new version, so a page that reloaded meanwhile shows it too; the sidebar reads the conversations again either way.
func (*App) EditRule ¶ added in v1.26.0
EditRule opens the rules editor on r, a rule Wit proposed in conversation conv as approval when the user asked ask (在编辑器里修改): nothing is saved until the user saves it there, which ends the proposal as saved.
func (*App) KeepInBackground ¶
KeepInBackground reports whether the backend keeps receiving once the window closes: 后台收信 is past 关窗后停止, or an enabled rule runs in the background.
func (*App) MailReady ¶ added in v1.36.0
MailReady reports whether the initial load has settled on onboarding or a loaded mail list. UI thread.
func (*App) Navigate ¶
Navigate goes back (dir < 0) or forward (dir > 0), as ⌘[ and ⌘] do: the Wit page forwards them, as native shortcuts miss keys it has.
func (*App) NewConversation ¶ added in v1.16.0
func (a *App) NewConversation()
NewConversation shows a new conversation, as the sidebar's 新对话 does.
func (*App) NotificationClicked ¶
NotificationClicked shows the window with what a notification was about: its message, the account's inbox for a gathered one, or the confirmation of godwit mcp's send requests (mcp_send:<id>). Only the newest click navigates, and only if the route has not changed meanwhile; a click before the first load waits for it. A click taken already is dropped: the backend and the interface may both be given it.
func (*App) OnUI ¶
func (a *App) OnUI(f func())
OnUI posts f to the UI thread unless the App has closed by then, for callbacks from elsewhere (the Wit page's).
func (*App) Open ¶ added in v1.36.0
Open shows what a launch (godwit --open) or the backend's tray asks for: OpenWindow, OpenCompose, or else a notification id (NotificationClicked).
func (*App) OpenAbout ¶ added in v1.39.4
func (a *App) OpenAbout()
OpenAbout navigates to Settings › About.
func (*App) OpenDraft ¶ added in v1.14.0
OpenDraft opens draft id in a compose window, unless it is in the outbox, read-only: then it says so. A draft it cannot read opens, to say why there.
func (*App) OpenLink ¶ added in v1.11.0
OpenLink handles a link a page shows (the Wit page's answers) as one in mail content, but its mailto drafts from the default account: no message is shown there, whatever the reader last showed.
func (*App) OpenMessage ¶
OpenMessage opens message id in the reader (a mail the Wit page cites).
func (*App) OpenModels ¶
func (a *App) OpenModels()
OpenModels opens the model settings (the Wit page's model chip).
func (*App) OpenSettings ¶ added in v0.2.0
func (a *App) OpenSettings()
OpenSettings opens the settings, as the app menu's Settings… does.
func (*App) QuitCancelled ¶ added in v1.36.0
func (a *App) QuitCancelled()
QuitCancelled tells the backend the user kept the interface open at a quit's prompt, so a quit the tray's 退出并停止收信 began does not stop it later (CancelTrayQuit). UI thread.
func (*App) Search ¶ added in v1.18.0
func (a *App) Search()
Search opens the search palette, as ⌘K and ⌘F do: the Wit page forwards them, as native shortcuts miss keys it has.
func (*App) SetForeground ¶
SetForeground records whether the window is in front, and tells the backend, which notifies new mail and narrows background syncs by it.
func (*App) SetWitAsk ¶
func (a *App) SetWitAsk(ask func(query string, quoted ...core.MessageSummary))
SetWitAsk gives the App the hand-off of a question, quoting mail, to the Wit page (the page starts the run itself, so it follows it and Stop works). Call it before Start.
func (*App) SetWitPage ¶
func (a *App) SetWitPage(view ui.NativeWebView, open, created func(conv int64) (version int64))
SetWitPage gives the App the Wit page's web view and open, which tells the page the route's conversation and returns its snapshot version; created does the same for a conversation the page's first question made. Call it before Start.
func (*App) SignatureHTML ¶ added in v1.9.0
func (a *App) SignatureHTML()
SignatureHTML is told the signature page asked for the HTML mode, its edit saved: the native code editor takes its place.
func (*App) SignatureLink ¶ added in v1.9.0
SignatureLink asks for a link's address in a dialog over the signature page: answer gets it (ok), "" with ok to take the link off, or ok false when cancelled. current is the link's at the selection, "" none.
func (*App) Start ¶
Start loads accounts and settings and starts the event pump. Cancelling ctx closes the App's work as Close does.
func (*App) SyncAll ¶
func (a *App) SyncAll()
SyncAll syncs every account now. The status shows syncing until the last one returns; a click while that batch is in flight starts nothing more.
func (*App) ToggleSidebar ¶ added in v1.39.4
func (a *App) ToggleSidebar()
ToggleSidebar folds or expands the left navigation sidebar.
func (*App) TrayIconShown ¶ added in v1.36.0
TrayIconShown reports whether the backend's tray shows Godwit's icon: the setting asks for it, but the system may have no tray. Asked as the window closes, on the UI thread: bounded, the setting standing in when it cannot.
func (*App) View ¶
View builds the window: the title bar, then the page's sidebar on the window material beside its content. First run shows only the onboarding page.
func (*App) WitOrigin ¶ added in v1.39.4
WitOrigin is where the Wit page's view is in the window, in DIPs from its top-left: the page's menus pop up at their own position plus it. Safe off the UI thread; zero before the view has been laid out.
func (*App) WitToast ¶ added in v1.39.4
WitToast shows text, which the Wit page asks for, as a toast of kind (kit.ToastSuccess, ToastWarning, ToastError or "") over the page (UI thread).
func (*App) WitToastBar ¶ added in v1.39.4
WitToastBar is where the Wit page's composer and its input are, in the page's coordinates (UI thread): its toasts rise above them. Empty ones put them back in the panel's corner.
type BodyGlassRect ¶ added in v1.39.4
type BodyGlassRect struct {
X, Y, W, H, R int
}
BodyGlassRect is a frosted surface's visible overlap inside a body page, in CSS pixels, rounded by R.
type ComposeFrame ¶ added in v1.39.4
type ComposeFrame struct {
// contains filtered or unexported fields
}
ComposeFrame is a compose window's native layer around its page: the title bar with the draft's subject and save status, which drags the window clear of its controls; the page's web view under it; and, over both, the toasts the page asks for, above its send bar. Its setters run on any goroutine and ask the window to draw again; App.ComposeView draws it on the UI thread.
func NewComposeFrame ¶ added in v1.39.4
func NewComposeFrame(view ui.NativeWebView, invalidate func()) *ComposeFrame
NewComposeFrame is the frame of view, which invalidate draws again.
func (*ComposeFrame) Close ¶ added in v1.40.0
func (f *ComposeFrame) Close()
Close tells f its window closed: a send later still open answers the page 0 and goes, and any asked after gets 0 at once.
func (*ComposeFrame) Origin ¶ added in v1.39.4
func (f *ComposeFrame) Origin() (x, y int)
Origin is where the page's view is in the window: page coordinates (a menu's) plus it are the window's.
func (*ComposeFrame) SendLater ¶ added in v1.40.0
func (f *ComposeFrame) SendLater(at int64) int64
SendLater opens send later at at, unix ms, and waits for the time chosen, 0 when cancelled or the window closes. An ask still open is cancelled.
func (*ComposeFrame) SetTitleBar ¶ added in v1.39.4
func (f *ComposeFrame) SetTitleBar(title, status string)
SetTitleBar shows title (the subject, or 新邮件) and status (the save state) in the title bar.
func (*ComposeFrame) SetToastBar ¶ added in v1.39.4
func (f *ComposeFrame) SetToastBar(bar, field ui.Rect)
SetToastBar places the toasts above the page's bar, level with field's right edge; empty rectangles put them back in the window's corner.
func (*ComposeFrame) Toast ¶ added in v1.39.4
func (f *ComposeFrame) Toast(kind, text string)
Toast shows text as a toast of kind: kit.ToastSuccess, ToastWarning, ToastError, or "" for a plain one.
type Deps ¶
type Deps struct {
Svc Service
Settings core.Settings
Platform Platform
Post func(func())
Clock Clock
OAuth OAuthFlow
// SystemLanguage is the system's language tag; the interface uses it
// while Settings.UILanguage is "".
SystemLanguage string
// SetLanguage applies the UI preference; an empty tag follows the system.
// By default only the catalog changes; the desktop also updates MyGo.
SetLanguage func(string)
// Vibrancy: the window has a material, which shows around the panel.
Vibrancy bool
// Logf logs what fails out of the user's sight (log.Printf by default).
// Lines carry no secrets and no mail content.
Logf func(format string, args ...any)
// Dev: the build is a development one: the rail offers the Kit gallery.
Dev bool
// ExternalAlways: the backend is the user's own godwit --headless, which
// serves external clients whatever Settings.LocalAPI says.
ExternalAlways bool
// Quit quits the app as its own Quit does; the backend's tray asks for it
// (events.QuitRequested). nil ignores that.
Quit func()
}
Deps are the App's collaborators. Post runs a function on the UI thread (win.Update in production). Clock and OAuth default to the real ones.
type MailNotifier ¶ added in v1.36.0
type MailNotifier struct {
// contains filtered or unexported fields
}
MailNotifier batches newly received mail per account and decides what to move to Junk or show as a system notification, without needing a window.
func NewMailNotifier ¶ added in v1.36.0
func NewMailNotifier(d MailNotifierDeps) *MailNotifier
NewMailNotifier constructs a MailNotifier.
func (*MailNotifier) Close ¶ added in v1.36.0
func (n *MailNotifier) Close()
Close cancels pending batches and in-flight notification work.
func (*MailNotifier) HandleEvent ¶ added in v1.36.0
func (n *MailNotifier) HandleEvent(ev events.Event)
HandleEvent gathers new messages from MessageReceived events for notifications, shown NotifyWait after the first arrival for that account.
type MailNotifierDeps ¶ added in v1.36.0
type MailNotifierDeps struct {
Svc MailNotifierService
Sink NotificationSink
Clock Clock
Foreground func() bool
Language func() string
Post func(func())
Logf func(format string, args ...any)
}
MailNotifierDeps are MailNotifier's collaborators.
type MailNotifierService ¶ added in v1.36.0
type MailNotifierService interface {
ListFolders(ctx context.Context, accountID int64) ([]core.Folder, error)
GetThread(ctx context.Context, threadID int64) (core.Thread, error)
BlockedSenders(ctx context.Context) ([]string, error)
MoveToRole(ctx context.Context, messageIDs []int64, role string) error
RecentSignInCodes(ctx context.Context, now time.Time) ([]core.SignInCode, error)
GetSettings(ctx context.Context) (core.Settings, error)
}
MailNotifierService is what MailNotifier reads and updates on the mail engine.
type Notification ¶
type Notification struct {
ID, Title, Subtitle, Body string
MessageID int64
Sender string // only set when preview is enabled
ThreadID int64
}
Notification is a system notification about a message.
type NotificationSink ¶ added in v1.36.0
type NotificationSink interface {
NotificationsSupported() bool
SignInCodeBannerSupported() bool
Notify(n Notification) error
}
NotificationSink delivers system notifications for MailNotifier.
type OAuthFlow ¶
type OAuthFlow interface {
Begin(ctx context.Context, provider, loginHint string, client core.OAuthClient) (flowID, authURL string, err error)
Await(ctx context.Context, flowID string) (email string, err error)
Cancel(flowID string)
}
OAuthFlow signs in with an OAuth provider; the default wraps the Service.
type Platform ¶
type Platform interface {
OpenURL(url string) error
OpenPath(path string) error
OpenFiles(multiple bool) ([]string, error)
OpenImage() (string, error)
OpenDirectory() (string, error)
SaveFile(defaultName string) (string, error)
Notify(n Notification) error
NotificationsSupported() bool
SetOpenAtLogin(on bool) error
// OpenAtLogin reports whether the login item runs: false once the user
// turned it off in the system. Blocks: call it off the UI thread.
OpenAtLogin() bool
SetAppUnread(n int) // the inboxes' unread total on the app icon; 0 clears it
ShowWindow() // shows the window, in front
SetThemeSource(theme string)
TempDir() string
// TypeIcon is the icon the file manager shows for files with extension
// ext (no dot), as a size by size pixel PNG. Blocks: call it off the UI
// thread.
TypeIcon(ext string, size int) ([]byte, error)
// DataDir is the data directory; custom: it is not the default one.
DataDir() (dir string, custom bool)
// OpenCompose shows draftID in a compose window of its own.
OpenCompose(draftID int64)
// ComposeOpen reports whether draftID's compose window is open or opening.
// The platform tells the App when that changes: ComposeWindowsChanged.
ComposeOpen(draftID int64) bool
// DraftDeleted is told draft id was deleted here: its compose window,
// if one is open, closes.
DraftDeleted(id int64)
// SettingsChanged is told the settings after every change.
SettingsChanged(st core.Settings)
// NewBodyView binds a reader page to message. initial, when non-nil, is the
// fresh sanitized read with remote images blocked. Release revokes the
// binding; reuse lets the platform keep the empty shell. UI thread only.
NewBodyView(message int64, initial *core.Message) (view ui.NativeWebView, release func(reuse bool), err error)
// ReloadImages retries the bound body's images under the current policy.
// Only manual (加载图片 for this message) may override that policy.
ReloadImages(message int64, manual bool)
// BodyGlass tells a body's page what the reader's frosted surfaces cover of
// it, in CSS pixels: top for the collapsing sticky header and bottom for the
// floating reply card. Used when system native glass is unavailable. UI thread only.
BodyGlass(view ui.NativeWebView, top, bottom BodyGlassRect)
// TranslateBody replaces only the body's text nodes; nil shows the original.
TranslateBody(message int64, texts map[string]string)
// Print prints the message's body page. UI thread only.
Print(message int64)
// NewSignatureView makes the signature page (a signature's rich-text
// editor, in Settings › Signatures) in the main window; the App makes
// one and closes it (unregistered and destroyed) as it closes. show
// switches it to signature id: the page saves the shown one's edit as
// that one first. flush asks the page to save now; done hears whether
// it did, on the UI thread, at most once. UI thread only.
NewSignatureView() (view ui.NativeWebView, show func(id int64), flush func(done func(ok bool)), close func(), err error)
// NewBirdView makes the About page's 3D bird in the main window; close
// destroys it. UI thread only.
NewBirdView() (view ui.NativeWebView, close func(), err error)
// CheckForUpdates checks now; the updater's own window shows the result
// and installs a newer version. The Store's package opens its Store page.
CheckForUpdates()
// LatestVersion asks the update feed (the Store's catalog for the
// Store's package) for a version newer than this one, without a
// window: "" when up to date. Blocks: call off the UI thread.
LatestVersion(ctx context.Context) (string, error)
// UpdatesInstallThemselves says whether a newer version installs without
// asking (the updater's automatic downloads): it waits for a relaunch.
// It may read a file: call off the UI thread.
UpdatesInstallThemselves() bool
// RepoStarred asks the GitHub CLI whether the user starred Godwit's
// repository: ok is false without gh signed in. Blocks.
RepoStarred(ctx context.Context) (starred, ok bool)
// StarRepo stars it with the GitHub CLI. Blocks.
StarRepo(ctx context.Context) error
}
Platform is what the App needs from the operating system. OpenFiles, OpenDirectory and SaveFile block: call them only off the UI thread.
type Route ¶
type Route struct {
Page Page
View core.View
ThreadID, MessageID, ConversationID int64
Settings string
Contact string // the contact the contacts page shows, by address
}
Route is where the App is.
type Service ¶ added in v1.36.0
type Service interface {
AccountIcon(ctx context.Context, id int64) (core.AccountIcon, error)
AddAccount(ctx context.Context, in core.AccountInput) (core.Account, error)
AddLocalArchive(ctx context.Context, name string) (core.Account, error)
AddMCPServer(ctx context.Context, in core.MCPServerInput) (core.MCPServer, error)
AddModelService(ctx context.Context, in core.ModelServiceInput) (core.ModelService, error)
AllAccountLabels(ctx context.Context) (map[int64][]core.Label, error)
ArchiveMessages(ctx context.Context, ids []int64, folderID int64) (core.ArchiveUndo, error)
ArchiveSender(ctx context.Context, addr string) (core.SenderArchive, error)
ArchiveThreads(ctx context.Context, threadIDs []int64) (core.ArchiveUndo, error)
ArchiveUsage(ctx context.Context, accountID int64) (int64, error)
AttachmentCacheUsage(ctx context.Context, accountID int64) (int64, error)
AwaitOAuth(ctx context.Context, flowID string) (email string, err error)
BeginOAuth(ctx context.Context, providerID, loginHint string, client core.OAuthClient) (flowID, authURL string, err error)
BeginPluginLogin(ctx context.Context, name string) (string, error)
BlockSender(ctx context.Context, from string) error
BlockedSenders(ctx context.Context) ([]string, error)
CachedAttachments(ctx context.Context, attachmentIDs []int64) (map[int64]string, error)
CancelOAuth(flowID string)
CancelOutbox(ctx context.Context, id int64) error
CancelPluginLogin(ctx context.Context, name, flow string) error
CheckAccount(ctx context.Context, in core.AccountInput) (core.CheckReport, error)
CheckModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ServiceCheck, error)
ClearAttachmentCache(ctx context.Context, accountID int64) error
ClearImageCache() error
ClearMaskingLog(ctx context.Context) error
ContactDetail(ctx context.Context, addr string) (core.ContactDetail, error)
ContactMail(ctx context.Context, addr, cursor string, limit int) (core.MessagePage, error)
Contacts(ctx context.Context) ([]core.Contact, error)
CountAppAndWitDeadlines(ctx context.Context) (int, error)
CreateLabel(ctx context.Context, in core.LabelInput) (core.Label, error)
CreateLocalFolder(ctx context.Context, accountID int64, name string) (core.Folder, error)
CreateSignature(ctx context.Context, name string) (core.Signature, error)
Delete(ctx context.Context, ids []int64) error
DeleteConversation(ctx context.Context, id int64) error
DeleteDraft(ctx context.Context, id int64) error
DeleteForever(ctx context.Context, ids []int64) error
DeleteLabel(ctx context.Context, id int64) error
DeleteLocalFolder(ctx context.Context, folderID int64) error
DeleteRule(ctx context.Context, id int64) error
DeleteSignature(ctx context.Context, id int64) error
DeleteView(ctx context.Context, id int64) error
DetectProvider(ctx context.Context, email string) (auth.Provider, auth.Source, error)
DownloadRecognitionModel(ctx context.Context, progress func(got, total int64)) error
DraftCounts(ctx context.Context) (map[int64]int, error)
DraftFromQuickReply(ctx context.Context, messageID int64, r core.QuickReply) (core.Draft, error)
EmptyFolder(ctx context.Context, folderID int64) ([]int64, error)
ExportAccountsFile(ctx context.Context) (string, error)
FetchAttachments(ctx context.Context, attachmentIDs []int64, fn func(path string, info core.AttachmentInfo) error) (err error)
Find(ctx context.Context, q core.FindQuery) (core.FindResult, error)
FirstTimeRecipients(ctx context.Context, addrs []string) ([]string, error)
GetDraft(ctx context.Context, id int64) (core.Draft, error)
GetMessage(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
GetMessageLazyImages(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
GetMessageText(ctx context.Context, id int64) (core.MessageText, error)
GetPluginConfig(ctx context.Context, name string) ([]core.ConfigValue, error)
RawMessageFile(ctx context.Context, messageID int64) (string, error)
GetSettings(ctx context.Context) (core.Settings, error)
GetThread(ctx context.Context, id int64) (core.Thread, error)
GrantMCPServer(ctx context.Context, id int64) error
GrantPermission(ctx context.Context, name string) error
ImageCacheSize() int64
ImagesAllowed(ctx context.Context, message int64) (bool, error)
ImportAccountsFile(ctx context.Context, path, digest string) (core.AccountImportResult, error)
ImportEML(ctx context.Context, accountID, folderID int64, paths []string) (core.ImportSummary, error)
InlineSignatureImages(ctx context.Context, html string) (string, error)
InstallPlugin(ctx context.Context, srcDir string) (core.PluginInfo, error)
InstallPluginFromRegistryWithProgress(ctx context.Context, name string, progress func(core.PluginInstallProgress)) (core.PluginInfo, error)
KeychainStatus(ctx context.Context) error
LabelModelReady(ctx context.Context) bool
ListAccounts(ctx context.Context) ([]core.Account, error)
ListActions(ctx context.Context, kind string) ([]core.ActionInfo, error)
ListConversations(ctx context.Context, kind string) ([]core.Conversation, error)
ListDrafts(ctx context.Context, accountID int64) ([]core.Draft, error)
ListFolders(ctx context.Context, accountID int64) ([]core.Folder, error)
ListLabels(ctx context.Context) ([]core.Label, error)
ListMCPServers(ctx context.Context) ([]core.MCPServer, error)
ListMessages(ctx context.Context, v core.View, cursor string, limit int) (core.MessagePage, error)
ListModelServices(ctx context.Context) ([]core.ModelService, error)
ListOutbox(ctx context.Context, accountID int64) ([]core.OutboxItem, error)
ListPluginModels(ctx context.Context) ([]core.PluginModels, error)
ListPluginRegistry(ctx context.Context) (core.RegistryView, error)
ListPlugins(ctx context.Context) ([]core.PluginInfo, error)
ListProviders() []auth.Provider
ListSignatures(ctx context.Context) ([]core.Signature, error)
ListSkills(ctx context.Context) ([]core.SkillInfo, error)
ListThreads(ctx context.Context, v core.View, cursor string, limit int) (core.ThreadPage, error)
ListTranslators(ctx context.Context) ([]core.TranslatorInfo, error)
LoadOlder(ctx context.Context, folderID int64) (more bool, err error)
MarkAllAsRead(ctx context.Context, v core.View) (int, error)
MarkViewRead(ctx context.Context, id int64) (int, error)
MaskingLog(ctx context.Context) ([]core.MaskRecord, error)
MCPScope(ctx context.Context) (core.MCPScope, error)
MessageGist(ctx context.Context, messageID int64) (string, error)
MessageLabels(ctx context.Context, ids []int64) (map[int64][]core.AppliedLabel, error)
ModelServiceAvatar(ctx context.Context, id int64) (core.Avatar, error)
MoveFrom(ctx context.Context, ids []int64, from, folderID int64) error
MoveToRole(ctx context.Context, ids []int64, role string) error
NewDraft(ctx context.Context, accountID int64, mode string, sourceMessageID int64) (core.Draft, error)
NewMailtoDraft(ctx context.Context, accountID int64, link string) (core.Draft, error)
PendingLabels(ctx context.Context) (int, error)
PendingMCPSends(ctx context.Context) ([]core.MCPSend, error)
PluginCards(ctx context.Context, messageID int64) ([]core.Card, error)
PluginLoginStatus(ctx context.Context, name string) (core.PluginLogin, error)
PluginLogout(ctx context.Context, name string) error
PluginReadme(ctx context.Context, name, lang string) (string, error)
PluginTags(ctx context.Context, messageID int64) ([]core.Tag, error)
PollPluginLogin(ctx context.Context, name, flow string) (core.PluginLoginState, error)
PrepareModelWithProgress(ctx context.Context, ref string, progress func(core.ModelStatus)) (core.ModelStatus, error)
PreviewAccountImportFile(ctx context.Context, path string) (core.AccountImportPreview, error)
PreviewMasking(ctx context.Context, st core.Settings, text string) (string, error)
PreviewRule(ctx context.Context, d core.RuleDoc, limit int) (core.RulePreview, error)
PreviewView(ctx context.Context, d core.SavedViewDoc, viewID int64, limit int) (core.ViewContents, error)
ProposedRuleSaved(ctx context.Context, id int64, r core.Rule) error
Purges(ctx context.Context, accountID int64) (map[string]core.Purge, error)
QuickReplies(ctx context.Context, messageID int64) ([]core.QuickReply, error)
RecentLog() string
RecentSignInCodes(ctx context.Context, now time.Time) ([]core.SignInCode, error)
RecheckSending(ctx context.Context, id int64) (core.CheckReport, error)
RecognitionModelBackend(ctx context.Context) (*core.RecognitionModelBackend, error)
RecognitionModelError() error
RecognitionModelInstalled() bool
RecordCapStatus(ctx context.Context, id, version int64, c string, st core.CapStatus) error
RefreshMCPTools(ctx context.Context, id int64) error
RefreshPluginRegistry(ctx context.Context) error
RemoveAccount(ctx context.Context, id int64) error
RemoveAppAndWitDeadlines(ctx context.Context) ([]core.RemovedDeadline, error)
RemoveMCPServer(ctx context.Context, id int64) error
RemoveModelFiles(ctx context.Context, ref string) error
RemoveModelService(ctx context.Context, id int64) error
RenameLocalFolder(ctx context.Context, folderID int64, name string) error
ReorderLabels(ctx context.Context, ids []int64) error
ReorderRules(ctx context.Context, ids []int64) error
RescanLabels(ctx context.Context, days int, all bool) (int, error)
RescanSecurity(ctx context.Context, days int, all bool) (int, error)
ResolveMCPSend(ctx context.Context, id int64, accept bool) error
ResolveMCPSendAcknowledged(ctx context.Context, id int64, digest string, send bool) error
ResolveOutbox(ctx context.Context, id int64, action string) error
RetryRuleRun(ctx context.Context, runID int64) error
RuleHitCounts(ctx context.Context) (map[int64]int, error)
RuleHits(ctx context.Context, ruleID int64) ([]core.RuleHit, error)
Rules(ctx context.Context) ([]core.Rule, error)
RulesInBackground(ctx context.Context) (bool, error)
TrayShown(ctx context.Context) (bool, error)
RunAction(ctx context.Context, id string, t core.Target, opts core.RunActionOptions) (core.ActionResult, error)
RunRuleOnExisting(ctx context.Context, ruleID int64) (int, error)
RunSkill(ctx context.Context, name string, t core.Target) (<-chan ai.Event, error)
SaveDraft(ctx context.Context, d core.Draft) (core.Draft, error)
SaveRule(ctx context.Context, r core.Rule) (int64, error)
SaveView(ctx context.Context, b core.SavedView) (int64, error)
SavedViews(ctx context.Context) ([]core.SavedView, error)
SearchWith(ctx context.Context, q core.SearchQuery, limit int) ([]core.MessageSummary, error)
SecurityProgress(ctx context.Context) (core.SecurityScanProgress, error)
SendAcknowledgedRevision(ctx context.Context, draftID, revision int64, digest string) error
SendRevision(ctx context.Context, draftID, revision int64) error
ApproveDraft(ctx context.Context, draftID, revision int64) error
SenderAvatar(ctx context.Context, messageID int64, allowRemote bool) (core.Avatar, error)
SetFlags(ctx context.Context, ids []int64, add, remove []string) error
SetLabel(ctx context.Context, messageIDs []int64, labelID int64, on bool) error
SetMCPServerEnabled(ctx context.Context, id int64, enabled bool) error
SetMCPToolTrusted(ctx context.Context, id int64, tool string, trusted bool) error
SetMessageSecurity(ctx context.Context, messageIDs []int64, reason string) error
SetPluginConfig(ctx context.Context, name string, values map[string]json.RawMessage) error
SetPluginEnabled(ctx context.Context, name string, enabled bool) error
SetPurge(ctx context.Context, accountID int64, role string, days int) error
SetRoleFolder(ctx context.Context, accountID int64, role string, folderID int64) error
SetRuleEnabled(ctx context.Context, id int64, on bool) error
SetMCPScope(ctx context.Context, sc core.MCPScope) error
SetSettings(ctx context.Context, st core.Settings) (core.Settings, error)
SetSkillEnabled(ctx context.Context, name string, enabled bool) error
SetUIForeground(ctx context.Context, on bool) error
SetViewException(ctx context.Context, id, threadID int64, kind string) error
SignatureCode(ctx context.Context, id int64) (string, error)
SignatureEditor(ctx context.Context, id int64) (string, error)
StarredCounts(ctx context.Context) (map[int64]int, int, error)
StopRescan(ctx context.Context) error
StopSecurityRescan(ctx context.Context) error
StoredHTML(ctx context.Context, id int64) (string, error)
Subscribe() (<-chan events.Event, func())
SyncNow(ctx context.Context, accountID int64) error
TaskModel(ctx context.Context, skill string) (string, error)
SummaryArrivalState(ctx context.Context) (core.SummaryArrival, error)
ConfirmSummaryService(ctx context.Context) error
CountUnrepliedToSummarize(ctx context.Context) (int, error)
SummarizeUnreplied(ctx context.Context) (int, error)
TestCapability(ctx context.Context, id int64, in core.ModelServiceInput, c string) (core.CapStatus, error)
TestPluginModel(ctx context.Context, ref string) (core.CapStatus, error)
ThreadLabels(ctx context.Context, threadIDs []int64) (map[int64][]core.AppliedLabel, error)
TrustImageSender(ctx context.Context, from string) error
TrustedImageSenders(ctx context.Context) ([]string, error)
UnblockSender(ctx context.Context, addr string) error
UndoArchive(ctx context.Context, a core.SenderArchive) error
UndoArchiveThreads(ctx context.Context, u core.ArchiveUndo) error
UndoRemoveAppAndWitDeadlines(ctx context.Context, removed []core.RemovedDeadline) error
UndoPurge(ctx context.Context, ids []int64) (gone int, err error)
UndoRuleRun(ctx context.Context, runID int64) (kept int, err error)
UninstallPlugin(ctx context.Context, name string) error
Unsubscribe(ctx context.Context, messageID int64) (core.UnsubscribeResult, error)
UnsubscribeMethod(ctx context.Context, messageID int64) (core.Unsubscribe, error)
UntrustImageSender(ctx context.Context, addr string) error
UpdateAccount(ctx context.Context, id int64, p core.AccountPatch) (core.Account, error)
UpdateLabel(ctx context.Context, id int64, in core.LabelInput) (core.Label, error)
UpdateMCPServer(ctx context.Context, id int64, in core.MCPServerInput) (core.MCPServer, error)
UpdateModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ModelService, error)
UpdatePassword(ctx context.Context, id int64, password string) error
UpdateSignature(ctx context.Context, id int64, p core.SignaturePatch) (core.Signature, error)
ViewContents(ctx context.Context, id int64, limit int) (core.ViewContents, error)
ViewExceptions(ctx context.Context, id int64) ([]core.ViewException, error)
ViewGroupPage(ctx context.Context, id int64, groupID, cursor string, limit int) (core.ViewGroupPage, error)
ViewTemplates(ctx context.Context) ([]core.ViewTemplate, error)
ViewWhy(ctx context.Context, id, threadID int64) (core.ViewReason, error)
ThreadDeadline(ctx context.Context, threadID int64) (core.ReaderDeadline, error)
SetThreadDeadline(ctx context.Context, threadID int64, d core.Deadline) (core.RemovedDeadline, error)
UndoSetThreadDeadline(ctx context.Context, before core.RemovedDeadline) error
AddAddressBook(ctx context.Context, in core.AddressBookInput) (core.AddressBook, error)
ContactAvatar(ctx context.Context, addr string) (core.Avatar, error)
ListAddressBookPresets() []core.AddressBookPreset
ListAddressBooks(ctx context.Context) ([]core.AddressBook, error)
RemoveAddressBook(ctx context.Context, id int64) error
RenameAddressBook(ctx context.Context, id int64, name string) error
ReorderAccountEntries(ctx context.Context, entries []core.AccountEntry) error
SetAddressBookCollectionEnabled(ctx context.Context, collectionID int64, enabled bool) error
SyncAddressBook(ctx context.Context, id int64) error
UpdateAddressBookAuth(ctx context.Context, id int64, password, oauthFlowID string, client core.OAuthClient) (core.AddressBook, error)
CancelTrayQuit(ctx context.Context) error
DevPreviewSignInCode(ctx context.Context, messageID int64, link bool) error
}
Service is the subset of the mail engine the native UI calls.
Source Files
¶
- app.go
- ask.go
- browser_signin.go
- clock.go
- clone_other.go
- compose_frame.go
- confetti.go
- contacts.go
- deadline.go
- downloads.go
- drafts.go
- errors.go
- features.go
- folder_actions.go
- kit_page.go
- labels.go
- latest.go
- layout.go
- links.go
- local_archive.go
- mail_filters.go
- mail_list.go
- mail_notifier.go
- mail_sidebar.go
- mcpsend.go
- menu_icon.go
- notify.go
- oauth_client_form.go
- onboarding.go
- outbox.go
- palette.go
- palette_filters.go
- palette_handoff.go
- palette_menu.go
- palette_preview.go
- plugin_config.go
- quarantine_other.go
- reader.go
- reader_ai.go
- reader_avatar.go
- reader_drafts.go
- reader_labels.go
- reader_timing.go
- recentlog.go
- savedview.go
- savedview_editor.go
- service.go
- settings.go
- settings_accounts.go
- settings_addressbooks.go
- settings_clients.go
- settings_extensions.go
- settings_general.go
- settings_labels.go
- settings_masking.go
- settings_masklog.go
- settings_mcpscope.go
- settings_models.go
- settings_models_local.go
- settings_models_view.go
- settings_nav.go
- settings_plugin_directory.go
- settings_rules.go
- settings_rules_editor.go
- settings_rules_files.go
- settings_search.go
- settings_signatures.go
- shell.go
- sync_status.go
- wit_menu.go
- writeq.go