jmap: read and send Fastmail mail over JMAP

Parcel spoke only Gmail's REST API, so a Fastmail account could not be added next to a Gmail one in the account switcher. Jmap.zig speaks JMAP (RFC 8620, 8621) and turns its replies into the mailbox's labels and threads: mailboxes with a role take the system labels' places, the rest are user labels by path, Archive is no label, and $flagged is Starred. JmapSession.zig runs a signed-in account the way Session, Sync, Pager, and Drafts do for Gmail. It reads the mail whole once, then asks Email/changes and Thread/changes every minute from the states kept in the cache. It sends each change as an Email/set and keeps the draft in Drafts until EmailSubmission sends it. An account is JMAP when its directory holds a jmap-token. `parcel login fastmail [NAME]` reads an API token without echo, checks it against the session resource, and saves it; `parcel login jmap NAME URL` does the same for another server. The desk's texts name the server instead of Gmail. Not yet: new-mail notifications, push through EventSource, and keeping the draft's id between runs.


Author rockorager.dev
Date Commit Parent fd05fcc3