Commit Graph

2388 Commits

Author SHA1 Message Date
Manos Pitsidianakis
1cce8c1162
melib/imap: accept invalid "+" CRLF cont req
Some servers erroneously send a "+" CRLF sequence instead of "+" SP
CRLF.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
a9e9d952d5
melib/imap: change termination_string arg to Option
Change ImapConnection::read_lines function argument termination_string
from &[u8] to Option<&[u8]>.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
eb27773b47
meli: add pager.named_filters setting
This new setting defines shell commands with names that can be applied
at any time on a text attachment by using the `filter` command without
any arguments.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
3251e7bd61
meli/config_macros.rs: scrub skip_serializing_if from attributes
If a config field has a skip_serializing_if value in the serde
attribute, remove it.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:09 +03:00
Manos Pitsidianakis
6e1fea8059
melib/jmap: show suggestions on Unauthorized error
Show suggestions for solving Unauthorized connection errors.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:08 +03:00
Manos Pitsidianakis
15f3a3fba6
meli/view: retry fetch envelope only if err.is_recoverable()
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:08 +03:00
Manos Pitsidianakis
f9a3b33397
melib/imap/operations: return NotFound on empty FETCH
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>
2024-06-28 11:15:08 +03:00
Manos Pitsidianakis
dd525bd940
meli/accounts: use Error::is_recoverable
Replace IsOnline::is_recoverable(err: &Error) with
new method Error::is_recoverable()

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:08 +03:00
Manos Pitsidianakis
8c880dc747
melib/error: add {Error,ErrorKind}::is_recoverable()
Add methods to guess whether the error is transient and can be recovered
from.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:08 +03:00
Manos Pitsidianakis
7200589a9e
melib/error: add ErrorKind::NotFound
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:08 +03:00
Manos Pitsidianakis
430cbdfd42
scripts/make_html_manual_page.py: fix python errors
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:07 +03:00
Manos Pitsidianakis
fe604bf0ea
Update "openssl" dependency to 0.10.64
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:07 +03:00
Manos Pitsidianakis
9fcb0a0451
Add cargo-deny configuration file deny.toml
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:07 +03:00
Manos Pitsidianakis
bbe2cffafe
Add rust-bindgen's friends.sh to scripts/
I run something similar to get each releases' contributor names, and
rust-bindgen happens to have this in a script, so let's import it.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:15:07 +03:00
Manos Pitsidianakis
6da4e2eca6
Replace stringify! in Debug impls with type checked macro
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>
2024-06-28 11:15:07 +03:00
Manos Pitsidianakis
e107d613a0
melib/backends: add prelude module for import cleanup
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>
2024-06-28 11:15:05 +03:00
Manos Pitsidianakis
c99633e141
Update futures dependency 0.3.28 -> 0.3.30
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:14:05 +03:00
Manos Pitsidianakis
9ab404c57a
view/filters.rs: add pgp signed attachment support
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:14:05 +03:00
Manos Pitsidianakis
c4f7b77a39
view: rework attachment rendering logic with filters
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-28 11:14:05 +03:00
Andrei Zisu
c04b593bdf
Use BODY instead of RFC822
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.
2024-06-28 11:14:05 +03:00
Manos Pitsidianakis
0ffe7fa5b3
melib: add text/plain or text/html arg for text decoding
In the function that decodes attachments to text, the default was
Text::Plain. Now it's passed via an argument so that Text::Html can also
be used.
2024-06-28 11:14:05 +03:00
Andrei Zisu
b4579075a8
melib/imap: Allow XOAUTH2 string passed as string
For cases in which the user of melib already knows the token and auth
string and doesn't have to call an outside command.
2024-06-28 11:14:04 +03:00
Andrei Zisu
6f61176a99
Remove unecessary mut modifier
This also makes sense semantically since as_bytes shouldn't be
performing any mutations.
2024-06-28 11:14:01 +03:00
Manos Pitsidianakis
7bdc8f52b1
mail/listing: highlight_self also when self is sender
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-15 16:45:10 +03:00
Manos Pitsidianakis
7e8d19afc7
melib/email.rs: add Envelope::sender_any
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>
2024-06-15 16:45:09 +03:00
Manos Pitsidianakis
d3a45b3442
melib/notmuch: make default shared lib name a const
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-15 16:45:09 +03:00
Manos Pitsidianakis
27c4876fca
mail/listing: Prevent log flooding when drawing listing entries
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-15 16:45:09 +03:00
Manos Pitsidianakis
ff3fe07758
Fix new 1.79.0 clippy lints
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-15 16:45:09 +03:00
Damian Poddebniak
7856ea33f0 refactor: Transition more to imap-codec 2024-06-08 17:50:35 +03:00
Damian Poddebniak
a8956bafc8 chore: Update to imap-codec v2.0.0-alpha.1 2024-06-08 17:49:55 +03:00
Manos Pitsidianakis
f1332e82b6
Bump version to 0.8.6
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-08 11:55:13 +03:00
Manos Pitsidianakis
819551876d
view/envelope: fix decryption error not shown
Closes #409

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-05 19:46:38 +03:00
Manos Pitsidianakis
01bc62e0ad
melib/attachments: add new_plaintext method
Add new convenience method AttachmentBuilder::new_plaintext(Vec<u8>)

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-05 19:46:38 +03:00
Manos Pitsidianakis
8dd87c1ac5
melib/email: add ContentType::is_text_plain()
Simple helper method to check if content-type is text/plain

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-03 10:12:26 +03:00
Manos Pitsidianakis
e9dd6becc3
.gitea/PULL_REQUEST_TEMPLATE.md: comment out content
I suspect this is annoying to see when opening a PR for everyone and not
just me, so I comment it out by default.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-02 15:15:34 +03:00
Manos Pitsidianakis
6be25ac3df
melib/jmap: don't use client field for get/posts
HTTP Requests should go through the get_async()/post_async() methods of
JmapConnection, which traces requests if optional feature `jmap-trace`
is enabled.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-02 15:15:34 +03:00
Manos Pitsidianakis
33999fc6ab
melib/jmap: re-add Submission to USING
Submission capability is necessary for Identity retrievals.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-02 15:15:34 +03:00
Manos Pitsidianakis
45bfcf8707
melib/email/headers/standards.rs: minor refactors
Refactor the standards! macro to remove unnecessary repetitions, and
also add RFC2183 as source for the Content-Disposition header.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-02 12:17:56 +03:00
Manos Pitsidianakis
3bab5324c4
melib/email: Improve Debug impl for ContentType etc
Improve Debug impl for ContentType, Text, ContentTransferEncoding which
all include bytes in some of their variants. The derived Debug
implementation did not show them as readable ascii strings, so a custom
impl was necessary to make it readable.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-06-02 12:15:33 +03:00
Manos Pitsidianakis
2bfe608678
view.rs: hide self from "add contacts" options
Adding ourselves to our contacts doesn't make sense (in the generic
case) so remove them from the list that is shown when the user selects
the add contacts shortcut.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-30 15:44:19 +03:00
Manos Pitsidianakis
e8e7697001
terminal: fix edge case with strings/linebreaking
When printing and line-breaking a string in CellBuffer::write_string(),
the line should continue from the "beginning" of the previous one.
However it might be different than the offset of the first character of
the string, because it may be indented already.

This would result in awkward line breaks like:

            Available actions: [ list- |# end of terminal/border
            post, list-unsubscribe, lis|
            t-archive ]

This commit adds an extra argument to write_string() to specify the x
offset of the string, so that we can apply it while printing characters
but ignore it when the line changes; then the x coordinate will take the
value of the line_break value.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-30 13:58:56 +03:00
Manos Pitsidianakis
74f0d12afb
tools: remove obsolete imapshell.rs and smtp_conn.rs
Previous commits added shells in the main binary.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 22:47:35 +03:00
Manos Pitsidianakis
571bd98497
Add proper imap-shell in tools subcommand for debugging
Add imap-shell to tools subcommand.

To use, run

  $ meli tools imap-shell <account-name>

Where account name is what you have in your config file.

For convenience, typing an invalid name will list all the valid names:

  $ meli tools imap-shell "asdf"
  The configuration file does not contain the account `asdf`. It contains the following:
  user@example.com
  work
  personal account
  Try again with a valid account name.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 22:46:08 +03:00
Manos Pitsidianakis
e187bb3f0d
Add tools subcommand with smtp shell for debugging
Add tools subcommand, with options to launch imap, smtp or jmap shells.
Currently only smtp is implemented, imap is working but with quirks.

To use, run

  $ meli tools smtp-shell <account-name>

Where account name is what you have in your config file.

For convenience, typing an invalid name will list all the valid names:

  $ meli tools smtp-shell "asdf"
  The configuration file does not contain the account `asdf`. It contains the following:
  user@example.com
  work
  personal account
  Try again with a valid account name.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 22:46:08 +03:00
Manos Pitsidianakis
74a3539f88
terminal/cells.rs: fix degenerate OOB cell access
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 21:16:59 +03:00
Manos Pitsidianakis
7eed944abc
melib/jmap: fix screwed up rfc8620 module split
I first split the rfc8620.rs into two files with an octopus merge but
getting fixups autosquashed in rebase was impossible with this approach.
So I made the split manually and botched the state of the two splitted
halves.

This commit removes extraneous code and the unused rfc8620.rs file.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 13:59:03 +03:00
euxane
3de4908d6b man(7): fix typo for toggle_expand_headers
Signed-off-by: euxane <euxane.trangirard@pacien.net>
2024-05-29 12:36:32 +02:00
Manos Pitsidianakis
f2b59a7633
jmap: add RequestUrlTemplate type
Add type that preserves both text (String) and parsed Url value for a
Url template.

Also add a test to catch regressions.

Closes #403 (JMAP: message body fetching broken on v0.8.5)

Fixes: 51e3f163d4 ("melib/jmap: Use Url instead of String in deserializing")
Resolves: https://git.meli-email.org/meli/meli/issues/403
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 00:51:13 +03:00
Manos Pitsidianakis
f7838b1ddf
jmap/rfc8620.rs: split to methods.rs and objects.rs
Split rfc8620 to two separate files.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 00:51:12 +03:00
Manos Pitsidianakis
a78f3f261d
jmap/rfc8620: move submodules to jmap/
Part of simplifying jmap module hierarchy.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2024-05-29 00:51:12 +03:00