Manos Pitsidianakis
e19f3e572c
Cargo-sort all Cargo.toml files
...
With:
cargo sort --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace meli
cargo sort --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace melib
cargo sort --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace tools
cargo sort --grouped --order package,bin,lib,dependencies,features,build-dependencies,dev-dependencies,workspace fuzz
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-10 15:33:10 +02:00
Manos Pitsidianakis
f900dbea46
Use cargo-derivefmt to sort derives alphabetically
...
Used https://github.com/dcchut/cargo-derivefmt
With command:
cargo install --locked \
--git https://github.com/dcchut/cargo-derivefmt \
--bin cargo-derivefmt \
--rev 2ff93de7fb418180458dd1ba27e5655607c23ab6
Since it's not on crates.io at the moment.
Sample diff:
-#[derive(Debug, Deserialize, Clone, Serialize)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-09 21:28:12 +02:00
Manos Pitsidianakis
3a70979483
Update minimum rust version from 1.65.0 to 1.68.2
...
Found with `cargo msrv --bisect --min 1.67.0`
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-09 18:01:12 +02:00
Manos Pitsidianakis
d16afc7d8d
Bump version to 0.8.5-rc.2
...
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-04 17:22:56 +02:00
Manos Pitsidianakis
63a63253d7
melib/datetime: use type alias for c_char
...
On arm64, it's u8, not i8.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-03 18:08:48 +02:00
Manos Pitsidianakis
10c3b0eabe
Bump version to 0.8.5-rc.1
...
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-02 19:20:34 +02:00
Andrei Zisu
64898a0583
melib/imap: Make UIDStore constructor pub
...
I honestly forget exactly why this change is needed, so I need to
recheck.
2023-12-02 19:05:13 +02:00
Andrei Zisu
77a8d9e2c2
melib: Make ModSequence publicly accessible
...
This way it can be imported from this namespace in depending code.
2023-12-02 19:00:48 +02:00
Manos Pitsidianakis
23c15261e7
mail/view: abstract envelope view filters away
...
Modularize an envelope view by introducing a stack of "view filters".
Example uses:
- html email can have a view on top of it that is plain text conversion
- selecting and viewing text/* attachments is just appending a new filter at
the stack
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-02 17:20:39 +02:00
Manos Pitsidianakis
1c1be7d6c9
melib/address: add display_name(), display_slice(), display_name_slice() methods
...
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-12-02 17:20:39 +02:00
Manos Pitsidianakis
23507932f9
imap: update cache on set_flags
...
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-27 09:37:58 +02:00
Manos Pitsidianakis
6506fffb94
Rewrite email flag modifications
...
Flag and tag modifications are now somewhat typed better, and the
frontend applies them on its own on success. This means that if you set
an unseen mail as seen but it was already seen in the backend, you will
see the change locally. Previously it would remain unseen.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-24 12:58:21 +02:00
Manos Pitsidianakis
f81a1e2338
Bump version to 0.8.4
...
0.8.3 had a misbehaving test.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-11-22 21:48:59 +02:00
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
Manos Pitsidianakis
5c2b04719b
Normalize std::fmt::* imports
2023-08-11 13:16:47 +03:00
Manos Pitsidianakis
7c7f6e1923
melib/thread: don't increase Thread length for duplicates
...
If an envelope that was already in the Threads object was inserted,
the only modification would be to erroneously increase the Thread len by
one.
2023-08-10 18:48:53 +03:00
Manos Pitsidianakis
84081f4ed7
melib/nntp: minor style fix
2023-08-10 18:48:36 +03:00
Manos Pitsidianakis
bf543855dc
melib/email: add PartialEq<str> for MessageID
2023-08-10 18:45:44 +03:00
Manos Pitsidianakis
448e0635e0
melib/nntp: log error when command length exceeds 512 octets
...
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.
2023-08-10 18:31:22 +03:00
Manos Pitsidianakis
4e654d2d02
melib/nntp: limit LIST ACTIVE command length to 512 octets
...
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
2023-08-10 18:30:59 +03:00
Manos Pitsidianakis
40d4ecefa0
melib/nntp: accept invalid (non-ascii) address comment text
...
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 .
2023-08-10 18:29:58 +03:00
Manos Pitsidianakis
8cb2a515e1
melib/smtp: use localhost in lieu of 127.0.0.1 for CI
2023-07-26 12:40:32 +03:00
Manos Pitsidianakis
ae25ffba43
melib/smtp: don't do plain EHLO before starting Tls connection
2023-07-24 10:57:35 +03:00
Manos Pitsidianakis
1e084c1d85
melib: move backends out of the backends module
...
No reason to have such a deep module tree.
2023-07-22 22:17:01 +03:00
Manos Pitsidianakis
9216e7bc65
melib/connections: add opt id string for tracing
2023-07-22 22:17:01 +03:00
Manos Pitsidianakis
8ecdb6df31
melib/imap: add imap-trace feature
2023-07-22 21:27:05 +03:00
Manos Pitsidianakis
b65934facc
melib/nntp: add nntp-trace feature
2023-07-22 21:15:59 +03:00
Manos Pitsidianakis
89c90f224a
melib: add nntp
feature
2023-07-22 21:01:42 +03:00
Manos Pitsidianakis
7db930cabd
melib: rename jmap_backend
feature to jmap
2023-07-22 20:54:55 +03:00
Manos Pitsidianakis
e9f09a153c
melib: rename mbox_backend
feature to mbox
2023-07-22 20:52:37 +03:00
Manos Pitsidianakis
fe7dcc508e
melib: rename notmuch_backend
feature to notmuch
2023-07-22 20:51:12 +03:00
Manos Pitsidianakis
fe027fa300
melib: rename maildir_backend
feature to maildir
2023-07-22 20:48:09 +03:00
Manos Pitsidianakis
129f10911b
melib: rename imap_backend
feature to imap
2023-07-22 20:46:23 +03:00
Manos Pitsidianakis
4874e30f3c
melib: add smtp-trace feature
...
If it's enabled, every read/write in an SMTP transaction will be logged
on TRACE level.
2023-07-22 16:25:54 +03:00
Manos Pitsidianakis
073d43b9b8
melib/test: move data files to data subdir
2023-07-21 18:12:39 +03:00
Manos Pitsidianakis
8e698cabcf
Fix unreachable-pub and disjoint-capture lint errors
2023-07-20 00:19:42 +03:00
Manos Pitsidianakis
bb7e119ade
Add gitea CI workflows
2023-07-19 17:12:15 +03:00
Manos Pitsidianakis
29b43e2c88
melib/datetime: replace mktime with timegm
2023-07-19 15:53:30 +03:00
Manos Pitsidianakis
6280bc75e5
melib/jmap: fix blob download URL formatting
2023-07-18 16:13:58 +03:00
Manos Pitsidianakis
48a10f7241
melib: remove unused BackendOp::fetch_flags() method
2023-07-18 16:13:58 +03:00
Manos Pitsidianakis
0219dc8707
melib/jmap: respect max_objects_in_get when fetching email
...
Fixes #144
2023-07-18 16:13:44 +03:00
Manos Pitsidianakis
c4c245ee19
melib/jmap: respect danger_accept_invalid_certs setting
2023-07-18 16:13:41 +03:00
Manos Pitsidianakis
e9cd800f49
melib/nntp: add support for storing read status locally
2023-07-16 11:46:33 +03:00
Manos Pitsidianakis
ab418c1d39
pgp: refresh documentation, fix encryption/signing
...
Closes #259
2023-07-15 19:33:20 +03:00
Manos Pitsidianakis
4e55fbc90d
nntp: add SEEN flag to all envs, since NNTP has no flags
2023-07-13 21:03:55 +03:00
Manos Pitsidianakis
13fe64a027
Cache pgp signature verification results
2023-07-13 17:18:13 +03:00
Manos Pitsidianakis
6086a3789d
Fix libgpgme segfault error and re-enable gpg
...
Closes #255
2023-07-13 16:51:37 +03:00
Manos Pitsidianakis
5b5869a2ec
logging: re-enable print to stderr ifdef MELI_DEBUG_STDERR
2023-07-13 16:49:50 +03:00
Manos Pitsidianakis
866166eb8e
attachments: don't print parsing error for empty bytes
2023-07-13 16:48:59 +03:00
Manos Pitsidianakis
d4e605c098
Add tagref source code annotations
...
Source Code Annotation Tags:
Global tags (in tagref format <https://github.com/stepchowfun/tagref >)
for source code annotation:
- [tag:hardcoded_color_value] Replace hardcoded color values with user
configurable ones.
- [tag:needs_unit_test]
- [tag:needs_user_doc]
- [tag:needs_dev_doc]
- [tag:FIXME]
- [tag:TODO]
- [tag:VERIFY] Verify whether this is the correct way to do something
- [tag:DEBT] Technical debt
2023-07-13 16:47:11 +03:00
Manos Pitsidianakis
d93ee413a7
melib/datetime: add timestamp_to_string_utc
...
Tests were using `timestamp_to_string` which in turn uses `localtime_r`
which assumes the local machine's time zone. Use gmtime_r instead.
Fixes #252
2023-07-09 18:50:35 +03:00