ADR 0378 §9 as amended by ADR 0379: a module of its own, built from mesh-mail's event shape, runs as its own account to hear mesh-mail's restricted MAIL stream (ADR 0376 §2), shows each new inbox mail through node-notifier.send at most once, folds more than three from one account into one notice, and emits its own shown event.
36 lines
1.9 KiB
Markdown
36 lines
1.9 KiB
Markdown
# mesh-mail-notifier — the default holder of mail-notifier
|
|
|
|
Built from mesh-mail's source (novox/hq ADR 0378 §9, as amended by ADR 0379, issue 800 part B): it carries a
|
|
byte-identical copy of mesh-mail's event shape (`mailevent.go`, pinned by `copies_test.go`, the way
|
|
`modules/networkmanager`'s `uplink-tools` carries `ifwatchd`'s own file, ADR 0241). Nothing here names
|
|
Betterbird (ADR 0379 §3), and nothing here reaches a mailbox: it only hears what mesh-mail already said.
|
|
|
|
## What it does
|
|
|
|
It claims `mail-notifier` (held once per machine, needing `node-notifier` there) and shows each new inbox mail
|
|
on this machine's notifier, through `node-notifier.send`, at most once:
|
|
|
|
- quiet during a first sync or a resync (mesh-mail already says nothing then, `imap.go` ~387)
|
|
- quiet for a mail from the account's own address (its address, from `mail-store.accounts`; not known, the
|
|
notice is shown)
|
|
- quiet for a mail already marked read (`\Seen` in its flags)
|
|
- quiet for anything outside the inbox
|
|
- more than three new mails from one account arriving close together become one notice naming the count and
|
|
the latest sender, rather than one notice each
|
|
|
|
Each notice shown emits this module's own event `shown` (account and message id, never sender or subject), and
|
|
is kept in its own state (`shown`) so a redelivered event is not shown twice.
|
|
|
|
## Where it runs
|
|
|
|
**Its own account** (`runs-as`), because it hears mesh-mail's restricted stream `MAIL` (novox/hq ADR 0376 §2):
|
|
the machine's runtime runs as the operator's account, which every agent shares and which never hears a
|
|
restricted stream. Held once per machine (wherever `mail-notifier` is assigned); the operator grants it the
|
|
accounts it announces, in mesh-mail's trusted setting `grants` (`mail-store`'s stream).
|
|
|
|
## Tools
|
|
|
|
| tool | does |
|
|
|---|---|
|
|
| `mail-notifier.status` | the accounts it announces on this machine, and when it last showed a notice; its rules. Read-only |
|