Commit Graph

2007 Commits

Author SHA1 Message Date
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
3433f7c41e
.gitea: update PULL_REQUEST_TEMPLATE.md
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-26 11:31:30 +03:00
Manos Pitsidianakis
9037f08495
listing: replace hardcoded Key::{Home,End} values with shortcut values
Replace hardcoded Key::{Home,End} values with shortcut values
"home_page" and "end_page".

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-26 11:25:20 +03:00
Manos Pitsidianakis
ffba203a3b
sidebar: add support for Home and End key navigation
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-26 11:17:21 +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
64982b4cab
mail/view/thread: fix page{up,down} event bubbling up
When pressing PageUp, PageDown, Home, End shortcuts in ThreadView
entries, the event is bubbled up to the mailbox listing because
ThreadView::process_event() didn't return `true`. This commit fixes
this bug.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-25 18:20:56 +03:00
Manos Pitsidianakis
4d22b669bf
Cargo.lock: update dependencies
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-25 08:25:12 +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
f162239fcc
.gitea/workflows: change on: conditions for test.yaml
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-24 11:37:35 +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
ab57e9420d
contacts: add delete_contact shortcut
New exciting feature: contact deletion.

Default shortcut is `d`.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-23 17:27:48 +03:00
Manos Pitsidianakis
095d24f914
.gitea: add PULL_REQUEST_TEMPLATE.md
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-21 16:07:41 +03:00
Manos Pitsidianakis
96f0b3e6b4
components: fix shortcut section order
Shortcut sections are shown in order, sorted by focus--as if widgets are
stacked vertically by the order you've opened them. In some widgets that
order was wrong.

Also, when a parent widget retrieved its child shortcuts, sometimes it
overwrote children sections if they both have them. This commit adds a
sealed trait ExtendShortcutsMaps that instead of overriding them, it
merges them with the child map having the priority.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-21 14:53:29 +03:00
Manos Pitsidianakis
f193bdf685
meli/jobs_view: add column headers and sorting
Sort with `sort <index> [asc/desc]` command or by pressing `1..5` keys.
Press them again to toggle between asc and desc.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-21 14:48:24 +03:00
Manos Pitsidianakis
f93adb683a
meli/terminal: replace change_color uses with change_theme
change_color() predated addition of Cell Attributes (Bold, Underline,
etc) so it didn't accept an attribute argument.

This commit adds a change_theme() function that does the same thing as
change_color() but also sets the cell attributes. It also takes a
ThemeAttribute as an argument instead of {fg, bg, attrs} individually.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-21 12:45:15 +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
52874f9a97
mail/view: cancel previous jobs on MailView drop/update
When MailView loads a new thread or gets dropped, cancel all pending
jobs.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-21 10:19:14 +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
67d2da0f88
ci: disable smtp::test::test_smtp in test.yaml
For some network-inside-docker reason this test fails, even thought it
works on my machines(TM).
2023-08-16 20:34:33 +03: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
kdwarn
6578a56668 Update cargo install directions
The release available on crates.io is 2 years old and would not compile ("enum `TokenTree` is private"), but installing from repo works.
2023-08-14 18:35:09 +00:00
Manos Pitsidianakis
0f60009ea9
Makefile: add RUSTFLAGS with -D warnings 2023-08-11 19:15:14 +03:00
Manos Pitsidianakis
5c2b04719b
Normalize std::fmt::* imports 2023-08-11 13:16:47 +03:00
Manos Pitsidianakis
7c9a4b4b7c
meli: Move components/mail -> mail 2023-08-11 13:01:32 +03:00
Manos Pitsidianakis
64ab65ddff
meli: Move components/contacts -> contacts 2023-08-11 12:49:06 +03:00
Manos Pitsidianakis
005bf3881e
meli: Move components/utilities -> utilities 2023-08-11 12:46:16 +03:00
Manos Pitsidianakis
a5446975c2
terminal: move braille and screen to their own module files 2023-08-11 11:00:59 +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
0ee1b6e018
account: start background watch job in init
When IsOnline was introduced, the background watch job stopped being
created when the connection was initialized. Restore that behavior.
2023-07-28 19:34:56 +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
6e27edcb77
ci: use cargo-nextest 2023-07-24 14:14:48 +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