Commit Graph

2569 Commits (05f404ba1f70b997b33808e1d1d2daeb3e826f6c)
 

Author SHA1 Message Date
Manos Pitsidianakis 7be8912c14
Cargo.tomls: make formatting more consistent
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 9e9c04a3f6
Update indexmap dep to 2.3.0
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis a8dad31776
melib/imap: renamed cache module to sync
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 6513c18810
melib/imap: on sync only update exists/unseen if loaded
When resyncing with resync_basic and resync_condstore, we would update
the unseen and exists counts for the mailbox without inspecting if the
mailbox was loaded or not. Since a previous commit reset total not yet
seen to 0 when inserting new entries to mail totals, this would lead in
unloaded mailboxes go from having their original unseen counts to having
only the new envelopes in the total.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
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>
3 months ago
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>
3 months ago
Manos Pitsidianakis 14f2d91193
melib/backends: change RefreshEvent field decl order
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
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>
3 months ago
Manos Pitsidianakis 3216324ccc
melib/mbox: impl FromStr for MboxFormat
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>
3 months ago
Manos Pitsidianakis 7020cd6698
meli: derive PartialEq/Eq for some types
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 33836a3263
melib/error: add WrapResultIntoError helper trait
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>
3 months ago
Manos Pitsidianakis 374ea8bacb
accounts: extract tests to tests.rs file
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
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>
3 months ago
Manos Pitsidianakis 20d7329263
melib: replace async-stream dep with async-fn-stream
Replace proc-macro stream impl with a non-macro one for better
compilation times

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 8e300c4661
melib/jmap: call req text(). asap
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>
3 months ago
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>
3 months ago
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>
3 months ago
Manos Pitsidianakis 6ae2cf0b6b
Bump version to 0.8.7
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis e329097d0b
melib/jmap: fix EmailBodyPart schema mismatch
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>
3 months ago
Manos Pitsidianakis f2e9cac38e
melib/jmap: use suggested minimum for maxObjectsInGet
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>
3 months ago
Manos Pitsidianakis 41d07fbcef
melib/jmap: newState in EmailImportResponse cannot be null
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 0b113cdbe1
Makefile: use MELI_FEATURES in all cargo invocations
Use env var MELI_FEATURES in all cargo invocations if set, otherwise use
--all-features

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 52c75e92b5
melib/jmap/email.rs: use HeaderName constants
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 8b568f6e3b
melib/jmap: add if_in_state argument in Set::new()
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>
3 months ago
Manos Pitsidianakis 46df4b573b
melib/attachments: remove unused function stub
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 85a55ed633
melib/backends: add some missing ErrorKinds to errors
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 824de287b4
melib/jmap: fix make_address! use
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>
3 months ago
Manos Pitsidianakis 197132cca0
melib/imap: support fetching with BODY[] for buggy servers
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>
3 months ago
Manos Pitsidianakis 8a74920dc7
CI: pin rust version to 1.79.0
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>
3 months ago
Manos Pitsidianakis 97af00cd83
melib/jmap: respect timeout value from user configuration
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>
3 months ago
Manos Pitsidianakis 15eeac5191
melib/jmap: enable dns_cache, tcp_keepalive & tcp_nodelay
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 27ac3061e1
mail/status.rs: fix tag support not being printed
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis afccebf331
melib/imap: add AUTH=PLAIN support
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis f5f1e06878
melib/imap: add UIDPLUS support
Add UIDPLUS extension support (Only UID EXPUNGE)

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
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>
3 months ago
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>
3 months ago
Manos Pitsidianakis 6379fbe8f4
meli/terminal: add support for Undercurl attribute
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 1e2e3da02f
meli/terminal/embedded: Treat color input `; ;` as `; 0 ;`
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
Manos Pitsidianakis 8552e499e8
meli/terminal/embedded: replace std::mem::{replace,take}
Non-functional change.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago
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>
3 months ago