Commit Graph

1010 Commits

Author SHA1 Message Date
Manos Pitsidianakis
ef30228e08
melib/draft: fix failing test
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 21:48:59 +02:00
Manos Pitsidianakis
bfc78a0803
melib/compose: replace CRLF with LF when editing
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 15:31:04 +02:00
Manos Pitsidianakis
af241d25cb
melib: bump version to 0.8.3
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 15:13:03 +02:00
Manos Pitsidianakis
ac2a5dcdd1
melib: add display() method for Address
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 14:14:56 +02:00
Manos Pitsidianakis
688e39a67e
Fix clippy lints
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 14:05:59 +02:00
Manos Pitsidianakis
8a21be2177
melib/imap: replace splice with truncate
splice() was calling memmove, it is a really inefficient way of
truncating a string.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-09 09:56:21 +02:00
Manos Pitsidianakis
f702dc220c
Fix new clippy lints.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-10-21 16:31:00 +03:00
Andrei Zisu
e95c275d68 Remove duplicate end sequence
Signed-off-by: Andrei Zisu <matzipan@gmail.com>
2023-10-02 22:07:20 +02:00
Andrei Zisu
3105a0373b Add quit command
Signed-off-by: Andrei Zisu <matzipan@gmail.com>
2023-10-02 22:07:17 +02:00
Andrei Zisu
7aec5b8e78 Fix SMTP example doc
Signed-off-by: Andrei Zisu <matzipan@gmail.com>
2023-10-02 22:07:10 +02:00
Manos Pitsidianakis
e88957ae6e
melib/backends: add extra_submission_headers field in MailBackendCapabilities struct
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-23 17:44:42 +03:00
Manos Pitsidianakis
3d85ca2edf
Bump version to 0.8.2
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-22 12:30:54 +02:00
Manos Pitsidianakis
7888d8b2a5
melib/utils/xdg: fix doc test compilation
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-22 12:26:42 +02:00
Manos Pitsidianakis
7eed82783a
Bump version to 0.8.1
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-13 19:08:21 +03:00
Manos Pitsidianakis
fe0a96f085
melib: update to 2021 edition
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-13 18:47:00 +03:00
Manos Pitsidianakis
9b9c38f769
mellib/imap: don't flood user with sqlite3 errors if db is corrupted
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-08 17:10:07 +03:00
Manos Pitsidianakis
c43aeb0eb1
melib/email/parser: fix invalid address parse on folded values
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-07 12:34:49 +03:00
Manos Pitsidianakis
6476985ce6
Add Cross.toml for aarch64-unknown-linux-gnu builds
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-05 15:33:28 +03:00
Manos Pitsidianakis
a615b4701b
dependencies: embed xdg-utils crate
No reason to have it out of the tree.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-03 10:13:25 +03:00
Manos Pitsidianakis
85af524458
email/parser.rs: fix invalid mailto() results when body field exists
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-01 15:57:46 +03:00
Manos Pitsidianakis
2dc2940586
melib/build.rs: add feature to use cache instead of downloading unicode data
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-01 15:55:43 +03:00
Manos Pitsidianakis
49a38a23bf
jmap: fix invalid Type link references
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-01 15:55:42 +03:00
Manos Pitsidianakis
b4f2f33576
remove deflate feature; make it a hard dependency
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-01 15:55:42 +03:00
Manos Pitsidianakis
a337e2269e
contacts: refactor module structure
To prepare for more functionality, refactor contacts module.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-30 01:12:45 +03:00
Damian Poddebniak
5459a84f3d chore: Update to imap-codec 1.0.0 (w/o -beta) 2023-08-28 18:16:48 +02:00
Manos Pitsidianakis
59513b2670
melib/jmap: implement Backend::submit(), server-side submission
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/277

https://git.meli.delivery/meli/meli/pulls/279

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 17:16:38 +03:00
Manos Pitsidianakis
38bc1369cc
melib/jmap: add an Identity type.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:54:34 +03:00
Manos Pitsidianakis
5d8f07c805
melib/jmap: rename some objects better
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:39:20 +03:00
Manos Pitsidianakis
b95f778335
melib/jmap: move JmapSession to its own module
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:39:17 +03:00
Manos Pitsidianakis
29fd8522e6
melib/jmap: implement Backend::create_mailbox()
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:35:13 +03:00
Manos Pitsidianakis
31982931f5
melib/jmap: use Argument<OBJ> (value or resultreference) where appropriate
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:31:05 +03:00
Manos Pitsidianakis
d9467d5fcd
melib/jmap: save all core capabilities to session store
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>
2023-08-28 14:27:34 +03:00
Manos Pitsidianakis
11432ba2c3
melib/jmap: make null fields into Option<_>s
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:21:47 +03:00
Manos Pitsidianakis
4f9b97736a
melib/jmap: Rename EmailImport to EmailImportObject
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:19:18 +03:00
Manos Pitsidianakis
6ebdc7f9ae
melib/jmap: add Id<_>::empty() contructor
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:16:11 +03:00
Manos Pitsidianakis
37a787e6bb
melib/jmap: use IndexMap instead of HashMap
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 14:12:05 +03:00
Manos Pitsidianakis
c875dda496
melib/jmap: add last_method_response field to Connection
For book keeping.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 13:58:20 +03:00
Manos Pitsidianakis
f7a4741bf1
melib/jmap: add jmap-trace feature
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 13:47:42 +03:00
Manos Pitsidianakis
8551e1ba0b
clippy: fix new 1.72 default clippy lints
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-25 19:49:26 +03:00
Manos Pitsidianakis
974b3a5305
Update bitflags, rusqlite dependencies
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-25 08:22:36 +03:00
Manos Pitsidianakis
946309c6f3
melib: do some small parser refactoring
- 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>
2023-08-24 11:32:21 +03:00
Manos Pitsidianakis
66c21ab173
melib/email: move StandardHeader to its own module
Extract StandardHeader code to its own module to reduce name.rs
line-count size.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-24 09:11:46 +03:00
Manos Pitsidianakis
3963103d55
contacts: prevent duplicate contact creation
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>
2023-08-23 17:29:21 +03:00
Manos Pitsidianakis
a1e7006186
melib: move Sort{Order,Field} to utils mod
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>
2023-08-21 12:41:50 +03:00
Manos Pitsidianakis
b3858de2f4
melib/error: impl From<io::ErrorKind> for ErrorKind
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>
2023-08-19 09:11:59 +03:00
Manos Pitsidianakis
dc2b00442b
melib: run rustfmt and cargo-sort 2023-08-19 09:07:55 +03:00
Manos Pitsidianakis
da8e810448
melib/connections: remove leftover debug prints 2023-08-19 09:06:31 +03:00
Damian Poddebniak
4f6081b663 chore: Update to imap-codec 1.0.0-beta. 2023-08-17 17:36:13 +02:00
Manos Pitsidianakis
df638cceec
melib/connections: remove stale failing doc code example
This leftover doc test/example was failing to compile, so remove it.
2023-08-16 19:50:48 +03:00
Manos Pitsidianakis
97d3686815
melib/connections: use Happy Eyeballs algorithm Ꙭ
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/rfc6555

Fixes #268
2023-08-15 09:55:46 +03:00