Commit Graph

2388 Commits

Author SHA1 Message Date
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
afccebf331
melib/imap: add AUTH=PLAIN support
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-18 11:01:57 +03:00
Manos Pitsidianakis
f5f1e06878
melib/imap: add UIDPLUS support
Add UIDPLUS extension support (Only UID EXPUNGE)

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-18 11:00:59 +03:00
Manos Pitsidianakis
06437e607c
melib/LazyCountSet: set not_yet_seen to 0 when inserting existing
Not yet seen behavior is unreliable and leads to false unread counts.
Set it to 0 instead when inserting an existing count.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-17 18:26:03 +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
96cc02a000
melib/imap/error: do not use ErrorKind::Configuration
Do not use ErrorKind::Configuration for ValidationError

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-17 16:54:15 +03:00
Manos Pitsidianakis
91fdef9820
melib/imap/cache: return NotFound on cache miss
Set error kind to NotFound instead of Bug, since it is possible a
mailbox state is not cached. Also add convenience function
ignore_not_found() that converts NotFound Err Results to Ok(()).

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-17 16:54:15 +03:00
Manos Pitsidianakis
b7da1d0f99
CI: check all targets in cargo-msrv verify test
cargo-msrv verify was verifying only library/binary targets, and missed
the test targets. Specify the check command to use so that all targets
are checked.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-15 13:48:49 +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
86f9b213bf
melib/jmap: add timeout conf field in validate()
`timeout` while valid was not checked in the validate() function, so it
could not be used: the validation would reject it.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-13 22:11:30 +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
1e50911c55
melib/imap: add utils module to protocol_parser
Add utils module with parser helpers for syntax items that can be NIL

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-12 16:04:32 +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
2429f17b44
melib/jmap: on invalid conf value, print what value is expected
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-11 09:06:34 +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
d1499242b2
melib/error: add From<Infallible> impl
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-09 11:01:54 +03:00
Manos Pitsidianakis
386208664b
melib/error: detect DNS lookup std::io::Error
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-09 11:01:17 +03:00
Manos Pitsidianakis
100fa8b3d1
melib/utils: fix edge case in ShellExpandTrait
If there is no "/" prefix after stripping the argument prefix, the
result was reverted.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-07-09 09:37:55 +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
5110813e87
melib/maildir: refactor MaildirOp and watch()
Refactor to remove unwraps and add None checks with returning errors
where appropriate.

Hopefully addresses #426

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-29 14:58:07 +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
Herby Gillot
dfc2bb4311 readme: add link to MacPorts page for meli
Signed-off-by: Herby Gillot <herby.gillot@gmail.com>
2024-06-29 02:22:44 -04: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
d40ee6928f
melib/imap: extract tests mod from protocol_parser
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:11 +03:00
Manos Pitsidianakis
7c47f70217
melib/sieve: extract test and parser modules to files
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:11 +03:00
Manos Pitsidianakis
ebc1fa3b8a
melib/sieve: move module to self dir
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
e96e9789db
melib/imap: don't discard pre-auth capabilities
The library user can retrieve capabilities from a mail backend, and they
might want to see pre-auth capabilities as well.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:10 +03:00
Manos Pitsidianakis
e3c1656e05
melib/imap: fix LOGINDISABLED support
LOGINDISABLED disables the LOGIN command, not authenticating in general;
doh! 🤦🤦🤦🤦

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