Commit Graph

47 Commits

Author SHA1 Message Date
Reto Brunner b6bcf89784 imap: add sort support 2020-10-11 09:18:45 +02:00
ARaspiK fe1cabb077 Add support for :rmdir
The `:rmdir` command removes the current directory (`-f` is required if
the directory is not empty).

This is not supported on the notmuch backend.

An issue with the maildir backend is that some sync programs (e.g.
offlineimap) may recover the directory after it is deleted.  They need
to specifically be configured to accept deletions, or special commands
need to be executed (e.g. `offlineimap --delete-folder`) to properly
delete folders.

A danger of using this on the IMAP backend is that it is possible for a
new message to be added to the directory and for aerc to not show it
immediately (due to a slow connection) - using `:rmdir` at this moment
(with `-f` if the directory already contains messages) would delete the
directory and the new message that just arrived (and all other
contents).  This is documented in aerc(1) so that users are aware of
possible risks.
2020-08-19 11:38:57 +02:00
ARaspiK 0535f6333f Add additional flagging functionality
More mail flags can now be set, unset, and toggled, not just the
read/seen flag.

This functionality is implemented with a new `:flag` and `:unflag`
command, which are extensions to the matching `:read` and `:unread`
commands, adding support for different flags.  In fact, the
`read`/`unread` commands are now recognized aliases to `flag`/`unflag`.
The new commands are also well documented in aerc(1).

The change mostly extends the previous read/unread setting functionality
by adding a selection for the flag to change.
2020-07-08 09:13:03 +02:00
Srivathsan Murali b1eb7ad18d Set AnsweredFlag on successful reply 2020-05-25 11:29:53 -04:00
Galen Abell 6ff3c7a1ba Mark sent messages as "seen" in maildir
- Add maildir flags to complement a messages imap flags
- Set the "seen" flag on sent messages when using the maildir backend
- Cleanup AppendMessage interface to use models.Flag for both IMAP and
  maildir
2020-03-03 20:08:37 +01:00
Reto Brunner f3dbecaaea remove the dirInfoUpdateRequest functionality
The notmuch worker followed suit in handling the dirInfo submission manually.
That removes the last user so we might as well remove the functionality.
2020-02-29 13:16:33 -05:00
Reto Brunner 5dd0f454c1 lib/msgstore: debounce directoryUpdateRequests
Apparently sending an event for every incoming messageInfo slows down
the application significantly.

Therefore this slows down the emmision rate, on the cost of being out of date
in some cases.
2020-02-25 11:05:26 -05:00
Reto Brunner 30c0a9fba4 imap: fix double closing idleStop
The idle restart code is at the end of handleMessage in the worker.
However if an unsupported msg comes in, we returned early, skipping the re-init.
That lead to a crash due to double closing idleStop in the next iteration.
2020-02-16 10:41:11 -05:00
Frode Aannevik 550ef0bc1f Fix: oauthbearer runtime error
Configure an oauthbearer source without a token_endpoint
parameter would panic due to nil pointer dereference

  Example
    source=imaps+oauthbearer://frode.aa%40gmail.com@imap.gmail.com:993
    source-cred-cmd=pass oatuh2 frode.aa@gmail.com

token_endpoint is not required as it will use the provided
password as access_token when it is not set
2019-10-16 11:04:41 -04:00
Wagner Riffel 90453b5db4 imap worker: do not copy mailbox status mutex
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-08-26 09:54:57 +09:00
Jelle Besseling aeca428c14 Don't print imap errors to ui
This fixes ~sircmpwn/aerc2#245. This sets up the imap client to send
error messages to the logger of the worker. Errors now end up in the
bottom status line.

https://todo.sr.ht/~sircmpwn/aerc2/245
2019-08-08 09:47:15 +09:00
Reto Brunner 6fed04bb9f Register worker in init.
This allows backends which can't always be compiled due to missing
dependencies (say libnotmuch) to be compiled conditionally with buildflags.
2019-07-19 15:37:55 -04:00
Frode Aannevik b0eaf5191c Support imaps with oauthbearer authentication (Gmail)
imaps+oauthbearer://user:token@host?token_endpoint=...

 - the config Source password is used as access token if
   no token_endpoint parameter is set
 - the config Source password is used as refresh token if
   token_endpoint parameter is set, and used to exchange
   with an access token

The implementation has only been tested with Gmail.

    source = imaps+oauthbearer://{username}:{refersh_token}@imap.gmail.com:993? \
    client_id=XX&\
    client_secret=XX&\
    token_endpoint=https%3A%2F%2Faccounts.google.com%2Fo%2Foauth2%2Ftoken

client credentials created with

    https://console.developers.google.com/apis/credentials

refresh token created with

    https://github.com/google/gmail-oauth2-tools/blob/master/python/oauth2.py

rel: https://todo.sr.ht/~sircmpwn/aerc2/42
2019-07-11 19:36:14 -04:00
Ben Burwell c610c3cd9d Factor IMAP-specific structs out of UI models
Before, we were using several IMAP-specific concepts to represent
information being displayed in the UI. Factor these structures out of
the IMAP package to make it easier for other backends to provide the
required information.
2019-07-08 16:06:28 -04:00
Ben Burwell cce7cb4808 Factor UI models out of the worker message package
Before, the information needed to display different parts of the UI was
tightly coupled to the specific messages being sent back and forth to
the backend worker. Separating out a models package allows us to be more
specific about exactly what a backend is able to and required to
provide for the UI.
2019-07-08 16:06:23 -04:00
Drew DeVault 198661bfbd worker/imap: rig up search directory handler 2019-06-24 16:31:37 -04:00
Reto Brunner 626f91c483 imap: respect the folder config option 2019-06-14 10:42:24 -04:00
Drew DeVault 6271d455eb Add :read and :unread commands 2019-06-09 14:55:42 -04:00
Drew DeVault 05f00f0153 Update our message flags when server updates them 2019-06-09 14:55:04 -04:00
Robert Günzler acfe7d7625 Add archive command
Adds an archive command that moves the current message into the folder
specified in the account config entry.

Supports three layouts at this point:

- flat: puts all messages next to each other
- year: creates a folder per year
- month: same as above, plus folders per month

This also adds a "-p" argument to "cp" and "mv" that works like
"--parents" on mkdir(1). We use this to auto-create the directories
for the archive layout.
2019-06-09 11:33:50 -04:00
Drew DeVault 2dc436555d Load IMAP worker for imap+insecure 2019-05-20 19:28:04 -04:00
Drew DeVault a9aebe11d7 asdf 2019-05-20 14:01:59 -04:00
Drew DeVault 98da4c9509 s/aerc2/aerc/g 2019-05-17 20:57:10 -04:00
Drew DeVault b0bf09b98f Copy sent emails to the Sent folder
Or rather, to a user-specified folder
2019-05-15 19:41:21 -04:00
Drew DeVault db213fd0ae Implement :copy (aka :cp) 2019-05-14 16:44:59 -04:00
Drew DeVault 3ace4ef732 Handle external message deletions 2019-05-13 20:23:23 -04:00
Drew DeVault 026e8a17ca Handle incoming emails gracefully 2019-05-13 20:16:55 -04:00
Drew DeVault 95875b13f8 Rename FetchMessageBodies to FetchFullMessages 2019-03-31 12:19:30 -04:00
Drew DeVault 27b25174e2 Make the message viewer real, part one 2019-03-31 12:14:37 -04:00
Drew DeVault 77ede6eb5a Add body fetching support code 2019-03-29 22:36:15 -04:00
Drew DeVault 312a53e5ff Implement :delete-message 2019-03-20 23:23:38 -04:00
Drew DeVault de364846cc Display message subjects in message list 2019-03-14 22:19:04 -04:00
Drew DeVault b3896476a0 Fetch valid UIDs from server after opening dir 2019-03-10 23:45:00 -04:00
Drew DeVault 4b350dddea Add name to DirectoryInfo messages 2019-01-13 19:37:06 -05:00
Drew DeVault 2750f99a60 Issue IMAP SELECT command 2019-01-13 16:18:10 -05:00
Drew DeVault d603bbe2ce Refactoring; consume listing response 2018-02-01 19:54:19 -05:00
Drew DeVault cc03f6f4c8 Implement (most of) mailbox listing 2018-02-01 19:34:08 -05:00
Drew DeVault d24e4712a4 Reduce boilerplate in worker/UI 2018-02-01 18:42:03 -05:00
Drew DeVault 3139148c7b Add certificate approval flow 2018-01-31 21:54:52 -05:00
Drew DeVault a21afdaa6b Improve logging 2018-01-31 21:18:21 -05:00
emersion 1710c90548 Connect to IMAP server, login and idle 2018-01-14 10:26:38 -05:00
Drew DeVault 4074445cbb Move worker into account tab 2018-01-11 09:04:18 -05:00
Drew DeVault db1b2cd53f Renderer scaffolding 2018-01-10 22:03:56 -05:00
emersion a0be5e8025 Misc idiomatic fixes 2018-01-10 11:20:41 -05:00
Drew DeVault 305446abfd Sleep main and worker loops on idle 2018-01-10 08:37:09 -05:00
Drew DeVault b5d5e0dbed Parse account configuration 2018-01-09 21:31:36 -05:00
Drew DeVault 6394e386c2 Initial pass on worker/UI message passing 2018-01-09 20:39:00 -05:00