Documentation
¶
Overview ¶
Package notify announces new mail on the desktop (docs/design/desktop.md, Notifications): the texts (notes.go) and, later, the D-Bus sender.
Index ¶
- Constants
- func Broadcast(publish func([]api.EventEnvelope)) func(ctx context.Context, accountID int64, mail []Mail) error
- func Buttons(m Mail) []string
- type Desktop
- func (d *Desktop) Announce(ctx context.Context, accountID int64, mail []Mail) error
- func (d *Desktop) Close() error
- func (d *Desktop) OnMail(f func(messageID int64, action string))
- func (d *Desktop) OnReminder(f func(id, action string))
- func (d *Desktop) Remind(ctx context.Context, rs []Reminder) error
- func (d *Desktop) Withdraw(ctx context.Context, active map[string]bool) error
- type Mail
- type Note
- type Reminder
Constants ¶
const ( ActionReply = "reply" ActionArchive = "archive" ActionTrash = "trash" )
What a message's note offers besides "default" (open the message): the keys of its buttons (parity P-805).
const ( ActionSnooze = "snooze" ActionDismiss = "dismiss" )
Reminder actions, besides "default" (open the app).
Variables ¶
This section is empty.
Functions ¶
func Broadcast ¶
func Broadcast(publish func([]api.EventEnvelope)) func(ctx context.Context, accountID int64, mail []Mail) error
Broadcast announces new mail to the connected clients instead of the desktop, for a maild with no session bus (docs/specs/lodge-app.md, The web build): one transient message.announced event carrying the notes Notes makes, which each client shows itself. It returns an announcer for mailsync.Config.Announce.
Types ¶
type Desktop ¶
type Desktop struct {
// contains filtered or unexported fields
}
Desktop sends notifications over a session bus and runs open with the message of a clicked one (0 for a group note).
func NewDesktop ¶
func NewDesktop(ctx context.Context, conn *dbus.Conn, log *slog.Logger, open func(messageID int64)) (*Desktop, error)
NewDesktop sends over conn and watches it for clicks until ctx ends.
func OpenDesktop ¶
func OpenDesktop(ctx context.Context, log *slog.Logger, open func(messageID int64)) (*Desktop, error)
OpenDesktop connects to the session bus.
func (*Desktop) Announce ¶
Announce shows the notes of one account's new mail (Notes). A group note replaces the account's previous group note.
func (*Desktop) OnMail ¶ added in v0.8.0
OnMail sets what a button of a message's notification does: action is ActionReply, ActionArchive or ActionTrash. Without it the notes have no buttons.
func (*Desktop) OnReminder ¶
OnReminder sets what clicking a reminder's notification or one of its actions does: action is "default", ActionSnooze or ActionDismiss.
type Mail ¶
type Mail struct {
ID int64
FromName string
FromAddr string
Subject string
Preview string
// Archive and Trash: the account has the mailbox each button moves to.
Archive bool
Trash bool
}
Mail is a newly arrived message to announce.