Well this was more complex that it should have been. And not very
optimized because we're not using pipelining in the submit() path:
1. first upload email bytes as a Blob object. This requires a standalone
API post call at a specific url so it cannot be changed with followup
calls to reference the blob's id.
2. Create an EmailObject in the drafts folder.
3. Create an EmailSubmission object referencing the email id of prevous
call. Unfortunately I cannot get the Result Reference to work in
stalwart jmap, so for now this is too a separate transaction.
Caveat emptor: Errors might not be returned to the user.
Closes#277.
https://git.meli.delivery/meli/meli/issues/277https://git.meli.delivery/meli/meli/pulls/279
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
We will need this in the future when we're going to support extra
extensions like Blob and also now to support server submission.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
- Use HeaderName in parsers instead of raw byte strings.
- Use byte literal constants where appropriate instead of repeating
&b"___"[..]
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
When adding contacts from an envelope view, its hash/id/key was a random
Uuidv4, so it was always possible to add a contact again and again with
no limits. Now, the id is calculated from the hash of the email address
and display name, preventing duplicate additions.
Note that the hash algorithm is not supposed to be stable across
versions, meaning that in the future the same contact might have a
different hash. This means a more sophisticated method for
detecting/disallowing dupes must eventually be introduced.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
We want to use SortOrder enum for non-thread purposes in the next
commit, so move it out of the thread module.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
We inspect errors in the frontend to check for network errors. If the
network error comes from std::io, this would get converted to an Error
with description "timed out", kind OSError, and source the actual
networking error.
This commit converts network std::io::ErrorKinds into appropriate
native ErrorKinds.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This commit adds a Happy Eyeballs [1] implementation taken from the
happy-eyeballs crate, which is in public domain.
While the function lookup_ip[0] iterates through the addresses returned by
A and AAAA records from a DNS lookup, it returns the first one which
always is an IPv4 address, unless there only is an AAAA record.
RFC6555 [1] recommends an algorithm for choosing the fastest address to
connect to, called "Happy Eyeballs". Ꙭ
[0]: melib/src/utils/connections.rs:497
[1]: https://www.rfc-editor.org/rfc/rfc6555Fixes#268
According to RFC 3977:
> Command lines MUST NOT exceed 512 octets, which includes the
> terminating CRLF pair
This commit adds a log::error entry when any sent command exceeds that
limit and recommends the user to report this as a bug.
According to RFC 3977:
> Command lines MUST NOT exceed 512 octets, which includes the
> terminating CRLF pair
Sending a `LIST ACTIVE` command with lots of newgroups and passing the
512 byte limit is therefore invalid. This commit splits the mailboxes in
chunks and sends a separate command for each maximal chunk that has
a valid length.
Fixes#269.
Reported-by: r3k2
NNTP servers may return addresses that are not RFC 5322 compliant. An
address with a comment with non-ascii characters will make the parser loop indefinitely.
Fixes#269.