Scrolling up/down with scroll_{up,down} shortcuts didn't work correctly,
because the form widget used its own shortcuts. This commit refactors
the cursor logic.
When connection fails to be established because of network issues,
perform an exponential back-off reconnection.
https://cloud.google.com/iot/docs/how-tos/exponential-backoff
This will limit maximum waiting time before next attempt and also
prevent reconnecting without wait when there's no reason to (network or
remote server is down).
The algorithm is really crude:
Instead of uniformly sampling 1..=1000 milliseconds, we sample (4 *
random::<u8>()) which is at most 4 * 255 = 1020 which is good enough.
1. Try to connect immediately
2. If it fails, set retries = 1.
3. Try to reconnect after retries * (4 * random::<u8>())
4. If it fails, set retries *= 2 = 2.
5. Try to reconnect after retries * (4 * random::<u8>())
6. If it fails, set retries *= 2 = 4.
7. Try to reconnect after retries * (4 * random::<u8>())
8. If it fails, set retries *= 2 = 8. Stop increasing retries from now
on.
9. Try to reconnect in a loop after retries * (4 * random::<u8>())
Instead of having a different widget to view mail in for each Listing
(plain, threaded, compact, etc) use a single widget in the listing's
parent type.
This will help with making the listing logic more modular in future
refactors to allow all combinations of listing/mail view/ thread view
positions and layouts.
compose-hooks run before submitting an e-mail.
They perform draft validation and/or transformations.
If a hook encounters an error or warning, it will show up as a notification.
The currently available hooks are:
- past-date-warn
Warn if Date header value is far in the past or future.
- important-header-warn
Warn if important headers (From, Date, To, Cc, Bcc) are missing or invalid.
- missing-attachment-warn
Warn if Subject, draft body mention attachments but they are missing.
- empty-draft-warn
Warn if draft has no subject and no body.
They can be disabled with [composing.disabled_compose_hooks] setting.
Forward email with shortcut 'forward' (default ctrl+f)
This opens a composing tab letting you to select receiver etc.
"composing" config setting "forward_as_attachment" selects the
forwarding behavior:
- "ask" asks you ever time
- true always forwards by attaching the entire email as a single
attachment
- false always forwards by inlining the email, like most email clients
do.
Closes#120
Not every job success should be shown to the user, for example updating
the sqlite3 database. So introduce a level to only show relevant
notifications.