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>
Add a FromStr implementation so that we can parse a string into a format
value from other places in the code.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Add a new WrapResultIntoError trait with method wrap_err() so we can
wrap a result and set its error as a source for a new error and
description, this allows for more descriptive error messages like:
Before:
let mbox_format = parse(some_string)?; <- error msg is "invalid mbox
format value, expected blah blah"
After:
let mbox_format = parse(some_string).wrap_err(|| "Could parse
configuration of account {}", account_name)?; <- error msg is "Could not
parse configuration of account myaccount, Caused by: invalid mbox format
value, expected blah blah"
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Call text() on a RequestBody as soon as it is returned, to avoid
exceeding timeout values, according to isahc documentation.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
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>
- 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>
EmailBodyPart required partId and blobId to be non-null, which is
invalid. Make them Option<_>s instead.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Instead of using the actual maxObjectsInGet batch size when fetching
email, use min(maxObjectsInGet, 500). This makes things not time-out
this easily when the maxObjectsInGet is large (e.g. 4096)
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
JMAP code should be using if_in_state wherever possible, to detect
mismatch between current server state and current client state.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
make_address! macro was called with a .take() expression, which was
substituted in the macro more than once hence take() would be called
more than once.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
It appears icloud IMAP servers do not support fetching RFC822 items with
the FETCH command. They reply to the fetch successfully but with the
item missing. To support this clearly non-standard and buggy behavior,
retry one more time by fetching with BODY[] instead if the RFC822 is
missing.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Stable release 1.80.0 has a regression causing compilation errors:
error[E0282]: type annotations needed for `Box<_>`
Pin stable version to 1.79.0, since we don't need anything later than
our MSRV anyway.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
While the timeout value was parsed, it was only used for mutex lock
timeouts and not the http connection.
This commit sets the isahc HTTP connections timeouts using the value, if
provided.
Fixes#422
Resolves: https://git.meli-email.org/meli/meli/issues/422
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
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>
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>
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>
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>
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>
`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>
- 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>
Accept "-" operand in create_config and test_config subcommands as
stdout and stdin respectively.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
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>
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>
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>
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>
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>
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>
.. 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>