Commit Graph

2034 Commits

Author SHA1 Message Date
Manos Pitsidianakis
49c36009ce
mail/view: don't initialize entire thread at once
For large threads, this would result in a lot of futures being created.
The user just wants to read one entry, not all of them. So prioritize
the open entry and some of the latest ones as an optimistic
pre-fetching.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-02 21:29:35 +03:00
Manos Pitsidianakis
c7825c76c3
mail/view: handle dialog Esc in the parent component
Dialogues handled Esc themselves, which meant the event didn't bubble up
to their parent to let them know they should remove the dialogue. This
commit fixes that.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-02 21:29:35 +03:00
Manos Pitsidianakis
3344a8dbf6
mail/view: remove unnecessary Clone derives
There's no need to clone MailViews when opening them in new tabs,
just initialize new ones with the same metadata. That saves us the
trouble of implementing Clone for all related types.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-02 19:36:12 +03:00
Manos Pitsidianakis
1b3bebe304
view/thread: open earliest unread email instead of first in thread
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-02 19:04:35 +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
0132677ff5
commands.rs: Introduce CommandError with context
There was no way to provide context to the user why their
command failed to be parsed. This commit paves the way of returning for
invalid domain values, invalid types, etc.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-09-01 15:55:43 +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
Manos Pitsidianakis
46636d8748
Bump version to 0.8.0
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-29 15:04:55 +03:00
Manos Pitsidianakis
65e82d8896
Add meli/README.md symbolic link
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-29 15:01:42 +03:00
Manos Pitsidianakis
1c79786ea2
Add scripts/make_html_manual_page.py
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-29 14:55:16 +03:00
Manos Pitsidianakis
290cfb86c0
themes: add a highlighted_selected theme key
So that if you select a mail/thread entry that is currently under the
cursor (making it `highlighted`) you can also see its `selected` status.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 23:50:17 +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
31aa9ad29e
listing: autogen mbox filename when exporting mail to directories
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
2023-08-28 18:20:38 +03: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
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