Commit graph

291 commits

Author SHA1 Message Date
Manos Pitsidianakis
6ee148c041
Fix 1.80.0 clippy lints
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-04 19:33:41 +03:00
Manos Pitsidianakis
94f345d731
Implement mailbox renaming command
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 16:03:43 +03:00
Manos Pitsidianakis
15d24ab0e3
meli/jobs: refactor spawn_{blocking,specialized} to spawn()
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 16:03:42 +03:00
Manos Pitsidianakis
2b3828d8d2
Update futures dependency to 0.3.30
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 16:03:42 +03:00
Manos Pitsidianakis
7be8912c14
Cargo.tomls: make formatting more consistent
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 16:03:42 +03:00
Manos Pitsidianakis
9e9c04a3f6
Update indexmap dep to 2.3.0
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 16:03:42 +03:00
Manos Pitsidianakis
84cfa358de
conf: remove need for global send_mail setting
This was a bad UX artifact from the very first meli versions. There's no
need to keep it around.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 16:03:41 +03:00
Manos Pitsidianakis
56b1bf28eb
meli/accounts: batch process refresh events
Process refresh events for a mailbox in a batch.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 15:27:23 +03:00
Manos Pitsidianakis
6906585942
accounts: split mailbox to enum out of JobRequest
Split mailbox related jobs out of JobRequest enum to its own enum since
JobRequest is getting too big to be readable.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 15:27:23 +03:00
Manos Pitsidianakis
7020cd6698
meli: derive PartialEq/Eq for some types
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-08-03 15:27:22 +03:00
Manos Pitsidianakis
374ea8bacb
accounts: extract tests to tests.rs file
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-31 08:22:13 +03:00
Manos Pitsidianakis
201081b6d4
meli/command: move tests to tests.rs
Move all command tests to a test submodule file.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-31 08:22:13 +03:00
Manos Pitsidianakis
f3d59ebf64
accounts: add force: bool arg to load()
Sometimes watch futures from backends send refresh events for mailboxes
that have not been fetched yet. That'd trigger fetching them in the
background, which is bad when the mailboxes are big and not wanted by
the user in the first place.

This commit adds a force parameter that specifies whether the loading
must be forced (e.g. when wanting to display the mailbox) or not.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-31 08:21:08 +03:00
Manos Pitsidianakis
a83b4176b0
meli.1: small fixes
- Use .Oo/.Oc for inline Optional arguments
- Replace "thread" selection with "entry"
- Spell out alternative arguments in set seen | unseen

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-31 08:20:39 +03:00
Manos Pitsidianakis
6ae2cf0b6b
Bump version to 0.8.7
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-30 17:23:38 +03:00
Manos Pitsidianakis
27ac3061e1
mail/status.rs: fix tag support not being printed
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-19 02:37:43 +03:00
Manos Pitsidianakis
a13bf13f24
meli/terminal/embedded: add stub Undercurl support
Add consumption of undercurl escape codes without parsing colors, as
there is no support for that in Cell yet.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-17 17:19:27 +03:00
Manos Pitsidianakis
6379fbe8f4
meli/terminal: add support for Undercurl attribute
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-17 17:19:27 +03:00
Manos Pitsidianakis
1e2e3da02f
meli/terminal/embedded: Treat color input ; ; as ; 0 ;
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-17 16:54:15 +03:00
Manos Pitsidianakis
8552e499e8
meli/terminal/embedded: replace std::mem::{replace,take}
Non-functional change.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-17 16:54:15 +03:00
Manos Pitsidianakis
9f783d9a07
meli/Cargo.toml: pin assert_cmd ver to 2.0.13
Version 2.0.14 onwards raises MSRV which is newer than the one we
support.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-15 13:46:21 +03:00
Manos Pitsidianakis
12695a00da
meli/tests: fix MSRV breakage
Commit 814af0e94d broke compilation with MSRV, it was not caught by CI
tests because they do not check the test targets for MSRV verification.

Fixes: 814af0e94d ("meli/args: add --gzipped flag to man subcommand")
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-15 13:43:38 +03:00
Manos Pitsidianakis
073aef8671
Fix lints/errors when compiling specific feature combos
- Building with sqlite3 non-bundled may result in compile-time error if
  the system version is not new enough; the bindgen feature must be
  enabled to create ffi bindings from the system version.
- Some unused code warnings show up if some features are disabled,
  refactor code to make them go away.
- Update libloading to 0.8 to prevent dual dependencies in
  Cargo.lock (rusqlite's bundled feature requires it)

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-13 18:30:35 +03:00
Manos Pitsidianakis
475860c946
meli/subcommands: accept - for stdio in {create,test}_config
Accept "-" operand in create_config and test_config subcommands as
stdout and stdin respectively.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-13 17:09:19 +03:00
Manos Pitsidianakis
814af0e94d
meli/args: add --gzipped flag to man subcommand
Add --gzipped flag to print a manpage without decompressing it, for
piping the output to a file. Because why not.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-13 17:09:19 +03:00
Manos Pitsidianakis
738f7c4695
meli/main.rs: execute Opt subcommand in Opt::execute()
Move execution of opt.subcommand, if it is given, in a method of the Opt
struct. The main() function is already too long given that it sets up
and handles the event loop, so this reduces the complexity a bit.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-13 13:50:19 +03:00
Manos Pitsidianakis
2dc1721a49
meli/main.rs: move signal handling stuff to submodule
Move signal handler notify setup function to its own submodule.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-13 13:48:06 +03:00
Manos Pitsidianakis
0dc2462358
mail/listing: fix one by off error on menu unread count
Last digit of unread counts when showing scroll bar was overwritten by
scroll bar. If scroll bar is visible, shift the unread count one column
to the left.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-12 14:59:46 +03:00
Manos Pitsidianakis
a8e82a302b
meli/docs/meli.conf.5: Add missing entries from JMAP
Configuration entries `use_token` and `timeout` were not included in the
JMAP section so add them.

Related to #422

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-11 09:08:36 +03:00
Manos Pitsidianakis
3ebf5510ea
meli/state.rs: pass entire screen area when drawing overlay
Let the widget decide how much area it needs instead of providing a
limited subsection. On small screens it can lead to not enough space.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-10 18:30:55 +03:00
Manos Pitsidianakis
a9122c6e34
meli/terminal/screen.rs: draw with x range argument
Instead of providing the horizontal range to draw as x_start and x_end
values, provide a range instead. This is to ensure that when you want to
draw from a bounds/row iterator, which has a col() method that returns
std::ops::Range<usize>, you don't end up drawing from col().start up to
including col().end like I foolishly did.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-10 18:23:25 +03:00
Manos Pitsidianakis
a85b3a089f
meli/accounts: allow default_mailbox to be any mailbox
.. And not just the ones defined in the configuration. Previously, it'd
only work if the mailbox was defined in the configuration file.

Also, make it so that the default mailbox is selected when meli is first
invoked, not just when changing to another account later.

Fixes #350

Resolves: https://git.meli-email.org/meli/meli/issues/350
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-09 13:40:33 +03:00
Manos Pitsidianakis
a330ff96e9
meli/accounts: retry on DNS failure
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-09 11:02:36 +03:00
Manos Pitsidianakis
608301dc3d
mail/view/envelope: Expand save-to paths asap
Paths entered via command were not expanded as soon as the text was
converted into a PathBuf, but when the save-to-file function was called.
This resulted in tilde expansion not happening until then, which because
of buggy behavior the previous commit fixed (expanding the tilde in the
middle of a path and pushing it to an existing path overwrites its
value, because expanding the tilde usually results in an absolute path),
resulted in the correct behavior. The invalid path was still visible on
the success message.

Instead, expand the path right away and then do modifications like
setting filename etc.

Fixes: #431
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-07 22:38:47 +03:00
Manos Pitsidianakis
39e903b1d3
melib/utils: fix issues with ShellExpandTrait
ShellExpandTrait was not expanding paths properly: tilde was expanded
even if it wasn't the first byte in the sequence. Since $HOME tends to
be an absolute path, the entire value of the path accumulator up till
that point was overwritten, meaning a /path/to/~/some/file would get
expanded to ${HOME}/some/file.

ShellExpandTrait was also not completing paths properly, especially
between the generic impl and the linux specialized one. This commit adds
test to make sure their behavior is synced and changes the result type
to an enum to make the result more descriptive.

Concerns #431.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-07 22:38:47 +03:00
Manos Pitsidianakis
9daf943758
meli/tests: add test_cli_subcommands.rs
Add test to catch any failure of CLI subcommand.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-30 16:45:44 +03:00
Manos Pitsidianakis
8dc4465c58
Fix toml value ser after update of toml dependency
Update in v0.8.5 required changes to serialization code;
toml::to_string() now serializes TOML documents, not values.

This commit replaces all occurances with toml::Value serializations.

Fixes: 8fff7401 ("Update yanked zerocopy dependency")
Closes: #429
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-29 21:15:04 +03:00
Manos Pitsidianakis
a82d1e1ebe
mail/listing.rs: fix RowsState::rename_env stale data
RowsState::rename_env was not updating all EnvelopeHash related fields
when a receiving an EnvelopeRename event, which can cause panics if the
listing tries to index it.

Concerns #426

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-29 12:30:33 +03:00
Manos Pitsidianakis
84d93d6555
melib/imap: add support for ID extension (opt-in)
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:11 +03:00
Manos Pitsidianakis
af6838c20c
melib: add metadata field to MailBackendCapabilities
Add field for arbitrary metadata as a serde_json::Value.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:11 +03:00
Manos Pitsidianakis
fd76df7889
meli/state: use MELI_CONFIG env var in mock tests
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:10 +03:00
Manos Pitsidianakis
5b6c1aa88c
mail/status.rs: don't show all background jobs
Information can be retrieved from :manage-jobs tab, so it's redundant to
repeat it here.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:10 +03:00
Manos Pitsidianakis
084a222a51
mail/status.rs: remove subscribed mailboxes list
Info is also available in :manage-mailboxes tab, so it's redundant.
Remove it.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:10 +03:00
Manos Pitsidianakis
122a2a4d76
accounts: drain event_queue when mailbox made available
RefreshEvents where put into event_queue field, but were never processed
again. Process them when Mailbox becomes available.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:10 +03:00
Manos Pitsidianakis
97aa6a8e6c
meli/docs: replace obsolete .Tn macro with .Em
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
9fb5bc41b4
melib/imap: impl AUTH=ANONYMOUS (RFC4505)
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
a9e9d952d5
melib/imap: change termination_string arg to Option
Change ImapConnection::read_lines function argument termination_string
from &[u8] to Option<&[u8]>.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
eb27773b47
meli: add pager.named_filters setting
This new setting defines shell commands with names that can be applied
at any time on a text attachment by using the `filter` command without
any arguments.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
3251e7bd61
meli/config_macros.rs: scrub skip_serializing_if from attributes
If a config field has a skip_serializing_if value in the serde
attribute, remove it.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
15f3a3fba6
meli/view: retry fetch envelope only if err.is_recoverable()
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:08 +03:00