Commit Graph

90 Commits (master)

Author SHA1 Message Date
Manos Pitsidianakis b0e867eb68
Move src to meli/src 2023-07-08 13:58:32 +03:00
Manos Pitsidianakis 6858ee1fab
meli: move subcommand handling to its own module 2023-07-03 09:38:43 +03:00
Manos Pitsidianakis 65179d4816
composer: fix cursor/widget focus scrolling logic
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.
2023-06-22 13:23:27 +03:00
Manos Pitsidianakis 0c0a678cff
state.rs: fix overlay widgets not being reaped after Unrealize event 2023-06-21 12:11:01 +03:00
Manos Pitsidianakis b05d929975
account: impl exponential backoff when retrying connection
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>())
2023-06-19 10:01:02 +03:00
Manos Pitsidianakis 5699baecfb
melib: add utils::{futures, random} 2023-06-19 10:01:02 +03:00
Manos Pitsidianakis 45bac6eb16
meli: Tidy up use of debug!
melib::debug! macro was deprecated when we started using the `log` crate
in `melib`. This commit replaces it with log::{debug,trace}! macro uses.
2023-06-17 21:14:15 +03:00
Manos Pitsidianakis 575509f1ed
mail/listing.rs: move mail view to listing parent component
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.
2023-06-17 21:14:15 +03:00
Manos Pitsidianakis 5c9b3fb044
component: impl Component for Box<dyn Component>
Useful to have.
2023-06-17 21:02:08 +03:00
Manos Pitsidianakis 27a4dcb916
Fix some rustdoc lints 2023-06-04 21:13:55 +03:00
Manos Pitsidianakis 299c8e0f99
meli: restructure pub use melib::* imports 2023-06-04 21:13:54 +03:00
Manos Pitsidianakis aebff3d3d9 melib: implement mailto RFC properly
This allows mailto links with `In-Reply-To` parameters to work properly.

PS Mailto links can be used with the `mailto MAILTO_URI` command
2023-05-30 16:52:29 +00:00
Manos Pitsidianakis 8c671935f9
Add compose (pre-submission) hooks for validation/linting
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.
2023-05-16 17:31:56 +03:00
Manos Pitsidianakis 85d4316a6a
Replace old logging module with the `log` create 2023-05-01 16:22:35 +03:00
Manos Pitsidianakis b1a7188771
Clippy fixes 2023-04-30 20:47:53 +03:00
Manos Pitsidianakis 5634f95553 Rename MeliError struct to Error 2022-12-08 22:20:05 +02:00
Manos Pitsidianakis 259aeb0087 Convert {Account,Mailbox}Hash from typedef to wrapper struct 2022-12-08 22:10:58 +02:00
Manos Pitsidianakis 16646976d7 compose: fix reply subject prefixes stripping original prefix
Unintelligent heuristic but should cover most cases?

Configurable subject response prefix #142
https://git.meli.delivery/meli/meli/issues/142

Closes #142
2022-10-09 18:31:01 +03:00
Manos Pitsidianakis a7a50d3078 src/: Box<_> some large fields in biggest types
As reported by `cargo +nightly typesize`
2022-09-19 15:18:25 +03:00
Manos Pitsidianakis 388d4e35d6 listing/offline.rs: add in-progress messages while connecting in IMAP 2022-09-11 15:00:30 +03:00
Manos Pitsidianakis eb5949dc9b melib/error.rs: switch summary<->details identifiers
They are more intuitive like this.
2022-09-02 12:12:12 +03:00
Manos Pitsidianakis 9cb66ef818 Fix all clippy warnings in `meli` crate 2022-08-25 16:38:02 +03:00
Manos Pitsidianakis 505adca54d
Add forward mail option
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
2021-10-02 13:38:50 +03:00
Manos Pitsidianakis e090c31f96
state: Move grid to Screen struct under terminal mod 2021-09-20 13:56:51 +03:00
Manos Pitsidianakis 13c5798c7b
conf/shortcuts.rs: add info_message_{next,previous} 2021-09-05 13:08:05 +03:00
Manos Pitsidianakis 3dba6fdf60
melib/datetime: add posix locale arg in timestamp_to_string() 2021-01-08 15:01:37 +02:00
Manos Pitsidianakis 1c25ae12eb
Use default_cell in CellBuffer resize(), clear() 2021-01-05 17:12:14 +02:00
Manos Pitsidianakis 48e7a493a9
Add reload-config command
Closes #84 Add "reload configuration" command
2020-12-02 21:01:22 +02:00
Manos Pitsidianakis e5b0ff4fe2
state: remove runtime_settings 2020-12-02 21:01:22 +02:00
Manos Pitsidianakis 7db32ff1b3
terminal/cells: return success flag in CellBuffer::resize() 2020-12-01 01:04:27 +02:00
Manos Pitsidianakis de018294e4
conf/themes: make notifications bg default color instead of red 2020-11-28 16:33:30 +02:00
Manos Pitsidianakis 76f8bdc558
Add configurable shortcut for 'quit'
Quit ('q' button) was hardcoded, switch to configurable shortcut setting
instead.
2020-11-15 21:30:54 +02:00
Manos Pitsidianakis 6392904047
Replace PosixTimer with async timers 2020-10-29 13:18:36 +02:00
Manos Pitsidianakis 7b1ab389fa
Remove unused plugin interface 2020-10-21 17:58:30 +03:00
Manos Pitsidianakis 4b91de3d59
state: remove overlay widgets on ComponentKill events 2020-10-20 23:19:13 +03:00
Manos Pitsidianakis 393c5d0d53
state: cull redraws of floating notifications
Cull redraws by keeping track of whether the floating box has been
initialised and whether its area has been drawn over by other dirty areas.
2020-10-15 21:28:28 +03:00
Manos Pitsidianakis 67f50d95f4
Add quit command 2020-10-14 20:14:07 +03:00
Manos Pitsidianakis 310d02042f
Rename toggle_thread_snooze to "toggle thread_snooze"
For consistency with other toggle commands.
2020-10-14 14:58:02 +03:00
Manos Pitsidianakis 188e020bd1
Add opt-in mouse support
Sidebar width can be resized with mouse hold and drag.
2020-10-14 14:58:02 +03:00
Manos Pitsidianakis a4b78532b7
Refactor job structs into JoinHandle
Put oneshot::channel<R> into JoinHandle<R>
2020-10-11 16:53:04 +03:00
Manos Pitsidianakis a2f11c341d
compose: add async draft filter stack in sending mail
Add a stack of "filter" closures that edit a draft before sending it.
Add PGP signing filter. An encryption filter will be added in a future
commit.
2020-10-11 16:53:04 +03:00
Manos Pitsidianakis 23ca41e3e8
add libgpgme feature 2020-10-05 21:10:00 +03:00
Manos Pitsidianakis fadf20d7b1
NotificationType: add melib::ErrorKind 2020-09-13 15:23:14 +03:00
Manos Pitsidianakis 843616221e
Add logging level to Generic jobs
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.
2020-08-26 19:17:54 +03:00
Manos Pitsidianakis c6f11fb592
melib: update notify to 4.0.15 2020-08-26 19:17:54 +03:00
Manos Pitsidianakis 9e9be0b5f3
Remove block_on from mailbox creation/deletion 2020-08-26 00:54:07 +03:00
Manos Pitsidianakis fc25c7b165
Fix compiler warnings 2020-08-26 00:54:07 +03:00
Manos Pitsidianakis 53e924eb33
Add edit envelope action back as async 2020-08-26 00:54:06 +03:00
Manos Pitsidianakis 94433cfc40
melib/backends: cleanup MailBackend trait definition 2020-08-26 00:54:06 +03:00
Manos Pitsidianakis 3eadaba34e
Replace old pseudo-async code with blocking rust async 2020-08-26 00:54:06 +03:00