Commit Graph

1034 Commits (escape8259-vendor)

Author SHA1 Message Date
Manos Pitsidianakis 38bc1369cc
melib/jmap: add an Identity type.
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 5d8f07c805
melib/jmap: rename some objects better
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis b95f778335
melib/jmap: move JmapSession to its own module
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 29fd8522e6
melib/jmap: implement Backend::create_mailbox()
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 31982931f5
melib/jmap: use Argument<OBJ> (value or resultreference) where appropriate
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
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>
10 months ago
Manos Pitsidianakis 11432ba2c3
melib/jmap: make `null` fields into Option<_>s
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 4f9b97736a
melib/jmap: Rename EmailImport to EmailImportObject
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 6ebdc7f9ae
melib/jmap: add Id<_>::empty() contructor
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 37a787e6bb
melib/jmap: use IndexMap instead of HashMap
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis c875dda496
melib/jmap: add last_method_response field to Connection
For book keeping.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis f7a4741bf1
melib/jmap: add jmap-trace feature
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 8551e1ba0b
clippy: fix new 1.72 default clippy lints
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
Manos Pitsidianakis 974b3a5305
Update bitflags, rusqlite dependencies
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
10 months ago
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>
10 months ago
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>
10 months ago
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>
10 months ago
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>
10 months ago
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>
10 months ago
Manos Pitsidianakis dc2b00442b
melib: run rustfmt and cargo-sort 10 months ago
Manos Pitsidianakis da8e810448
melib/connections: remove leftover debug prints 10 months ago
Damian Poddebniak 4f6081b663 chore: Update to `imap-codec 1.0.0-beta`. 10 months ago
Manos Pitsidianakis df638cceec
melib/connections: remove stale failing doc code example
This leftover doc test/example was failing to compile, so remove it.
10 months ago
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
11 months ago
Manos Pitsidianakis 5c2b04719b
Normalize std::fmt::* imports 11 months ago
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.
11 months ago
Manos Pitsidianakis 84081f4ed7
melib/nntp: minor style fix 11 months ago
Manos Pitsidianakis bf543855dc
melib/email: add PartialEq<str> for MessageID 11 months ago
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.
11 months ago
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
11 months ago
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.
11 months ago
Manos Pitsidianakis 8cb2a515e1
melib/smtp: use localhost in lieu of 127.0.0.1 for CI 11 months ago
Manos Pitsidianakis ae25ffba43
melib/smtp: don't do plain EHLO before starting Tls connection 11 months ago
Manos Pitsidianakis 1e084c1d85
melib: move backends out of the backends module
No reason to have such a deep module tree.
11 months ago
Manos Pitsidianakis 9216e7bc65
melib/connections: add opt id string for tracing 11 months ago
Manos Pitsidianakis 8ecdb6df31
melib/imap: add imap-trace feature 11 months ago
Manos Pitsidianakis b65934facc
melib/nntp: add nntp-trace feature 11 months ago
Manos Pitsidianakis 89c90f224a
melib: add `nntp` feature 11 months ago
Manos Pitsidianakis 7db930cabd
melib: rename `jmap_backend` feature to `jmap` 11 months ago
Manos Pitsidianakis e9f09a153c
melib: rename `mbox_backend` feature to `mbox` 11 months ago
Manos Pitsidianakis fe7dcc508e
melib: rename `notmuch_backend` feature to `notmuch` 11 months ago
Manos Pitsidianakis fe027fa300
melib: rename `maildir_backend` feature to `maildir` 11 months ago
Manos Pitsidianakis 129f10911b
melib: rename `imap_backend` feature to `imap` 11 months ago
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.
11 months ago
Manos Pitsidianakis 073d43b9b8
melib/test: move data files to data subdir 11 months ago
Manos Pitsidianakis 8e698cabcf
Fix unreachable-pub and disjoint-capture lint errors 11 months ago
Manos Pitsidianakis bb7e119ade
Add gitea CI workflows 11 months ago
Manos Pitsidianakis 29b43e2c88
melib/datetime: replace mktime with timegm 11 months ago
Manos Pitsidianakis 6280bc75e5
melib/jmap: fix blob download URL formatting 11 months ago
Manos Pitsidianakis 48a10f7241
melib: remove unused BackendOp::fetch_flags() method 11 months ago
Manos Pitsidianakis 0219dc8707
melib/jmap: respect max_objects_in_get when fetching email
Fixes #144
11 months ago
Manos Pitsidianakis c4c245ee19
melib/jmap: respect danger_accept_invalid_certs setting 11 months ago
Manos Pitsidianakis e9cd800f49
melib/nntp: add support for storing read status locally 12 months ago
Manos Pitsidianakis ab418c1d39
pgp: refresh documentation, fix encryption/signing
Closes #259
12 months ago
Manos Pitsidianakis 4e55fbc90d
nntp: add SEEN flag to all envs, since NNTP has no flags 12 months ago
Manos Pitsidianakis 13fe64a027
Cache pgp signature verification results 12 months ago
Manos Pitsidianakis 6086a3789d
Fix libgpgme segfault error and re-enable gpg
Closes #255
12 months ago
Manos Pitsidianakis 5b5869a2ec
logging: re-enable print to stderr ifdef MELI_DEBUG_STDERR 12 months ago
Manos Pitsidianakis 866166eb8e
attachments: don't print parsing error for empty bytes 12 months ago
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
12 months ago
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
12 months ago
Manos Pitsidianakis b0e867eb68
Move src to meli/src 12 months ago
Manos Pitsidianakis b5657201db
melib: fix doctest compilation errors 12 months ago
rek2 3803d788ab
if auth is false checks if config has password entry 12 months ago
rek2 b5f205b77b add availability to use server_password_command in the nntp backend like in the IMAP backend 12 months ago
Damian Poddebniak 7c33f8999b chore: Use published imap-codec 0.10.0. 12 months ago
Damian Poddebniak 34a54d3c05 docs: Add some `TODO(#222)`s. 12 months ago
Damian Poddebniak 9d51b6bd52 chore: Update `imap-codec`. 12 months ago
Manos Pitsidianakis 7998e1e77e
melib/datetime: add missing LC libc constants for openbsd target_os
Fixes #242

"Compilation failure on master on OpenBSD" #242
12 months ago
Manos Pitsidianakis 619fbef129
melib/thread: recursively calculate update_show_subject()
Walk the entire thread tree and update show_subject collectively when a
new entry is added.
12 months ago
Manos Pitsidianakis 1bcc0bbece
melib/mbox: add mbox parsing test 12 months ago
Manos Pitsidianakis e8e49e741b
melib/mbox: fix wrong per message offset 12 months ago
Manos Pitsidianakis 1dc1d86848
melib/shellexpand: fix infinite loop bug
Introduced in recent "fixing clippy lints" commit
12 months ago
Manos Pitsidianakis ba7f5dce1c
listing/thread: fix display of threaded conversations tree structure
When missing intermediate and/or parent messages in a thread, the
printed thread tree branches were completely invalid. This commit makes
sure thread node entries that have no corresponding envelopes are
accounted for in the tree structure.
12 months ago
Manos Pitsidianakis 5f29faa640
melib: clippy lint fixes 12 months ago
Manos Pitsidianakis f98e36cee5
melib: Replace old-style /*! module doc comments with //! 12 months ago
Manos Pitsidianakis f0d88005fb
melib/email: change message/rfc822 Display repr
Put subject first.
12 months ago
Manos Pitsidianakis e64923eeaa
melib/email/headers/names: fix debug_assert condition
On invalid parsings, _cnt can be equal to probe and chunk len because
the value won't be a valid header
1 year ago
Manos Pitsidianakis f5cfbd32e6
melib/imap: on set_flags, update {un,}seen sets in all mailboxes
Some envelopes might be in several mailboxes, for example in Gmail's
implementation of IMAP.
1 year ago
Manos Pitsidianakis 5699baecfb
melib: add utils::{futures, random} 1 year ago
Manos Pitsidianakis 4da5366959
Remove bincode dep, use serde_json for sqlite3 values 1 year ago
Manos Pitsidianakis fd0faade06
melib/imap: add connection instance id string for debugging in logs
- Add an ID field in ImapConnection and ImapStream that records where
  each instance was created. This is useful for differentiating main
  backend connections from watching thread connections (the ones that
  listen to updates from the IMAP server with IDLE or polling).
- Add an imap_trace! macro that uses log::trace! internally but also
  prepends the connection's ID string to each log line.
1 year ago
Manos Pitsidianakis 8f14a2373e
melib/imap: put imap-codec logic under the imap_backend feature 1 year ago
Damian Poddebniak 330887c4f5
refactor: Introduce imap-codec. 1 year ago
Damian Poddebniak 6c6d9f4b4e
chore: Improve ordering of `flag_impl!`s. 1 year ago
Damian Poddebniak 579372b4a7
chore: Improve readability of `Envelope`.
* Sorted according to RFC.
* Separated IMAP4rev1 and other values.
1 year ago
Manos Pitsidianakis cd85d83324
melib/email: replace timestamp with Date value in message/rfc822 Display 1 year ago
Manos Pitsidianakis e0257c9d8d
Run cargo-sort 1 year ago
Manos Pitsidianakis 27a4dcb916
Fix some rustdoc lints 1 year ago
Manos Pitsidianakis bf615e7d93
melib/thread: check for case when envelope has its own message id in References and In-Reply-To
Emails sent from meli's gitea do this, and it makes them invisible in
thread listings.
1 year ago
Manos Pitsidianakis b92a80a23a
melib/imap: resync even if UIDVALIDITY is missing from cache
I think this is related to #98 meli gets stuck on `set seen' for mail (threads) at random

https://git.meli.delivery/meli/meli/issues/98
1 year ago
Manos Pitsidianakis f8623d4b2c
melib/imap: implement more ResponseCode cases 1 year ago
Manos Pitsidianakis 299c8e0f99
meli: restructure pub use melib::* imports 1 year ago
Manos Pitsidianakis c5ecaceae1
melib/search: fix some search criteria in Query type 1 year ago
Manos Pitsidianakis 6bf1756de8 melib/search: implement more search criteria in Query type 1 year ago
Manos Pitsidianakis 23d95973d4 melib/backends/imap: add search.rs module
Add trait to convert melib::search::Query type to an IMAP appropriate
query string (search criteria).
1 year ago
Manos Pitsidianakis 6388bea9a0 melib/email/headers: fix &[u8] index in HeaderMap 1 year ago
Manos Pitsidianakis d332e4578d
melib/headers: add proper Display impl for HeaderName 1 year ago
Manos Pitsidianakis aebff3d3d9 melib: implement mailto RFC properly
This allows mailto links with `In-Reply-To` parameters to work properly.

PS Mailto links can be used with the `mailto MAILTO_URI` command
1 year ago
Manos Pitsidianakis 235fceaf21 melib: Add standard heeder constants in email::headers
Like `http` crate does
1 year ago