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>
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>
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>
`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>
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>
Refactor to remove unwraps and add None checks with returning errors
where appropriate.
Hopefully addresses #426
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
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>
Change ImapConnection::read_lines function argument termination_string
from &[u8] to Option<&[u8]>.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
If UID FETCH returns an OK response but without untagged fetch
responses, it means the UID was not found. Return a NotFound error in
this case and a ProtocolError in other error cases.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Add identify! macro which expands to stringify! but also const type
checks the value to prevent typos/wrong values.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
Add a prelude module under melib::backends that exports all types needed
to interact with a mail backend. This reduces the number of imports in
every related file.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
RFC3501 seems to prefer BODY attributes as the more modern equivalent
to RFC822. For example, this also allows us to use BODY.PEEK. Since the
fetch methods in melib are tightly coupled with the parser, we have to
add this here if we want to use BODY attributes during fetch.
Similar to Envelope::recipient_any, this method searches if its argument
exists in From: or Author: headers.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>