Commit Graph

143 Commits

Author SHA1 Message Date
Tero Koskinen f81cc2803c maildir: Provide nicer error message on invalid url
If accounts.conf contains an invalid maildir url, return a nice
error instead of panicking.

Log a couple of different error cases to provide extra
information about the error to the user.
2020-07-27 18:26:57 +02:00
Reto Brunner c574a838fa Remove hard coded bodystruct path everywhere
Aerc usually used the path []int{1} if it didn't know what the proper path is.
However this only works for multipart messages and breaks if it isn't one.

This patch removes all the hard coding and extracts the necessary helpers to lib.
2020-07-27 09:19:27 +02:00
Tobias Wölfel 494bd674a9 Add flag based search options
Provide search and filter with the option to specify more flag based
conditions.
Use '-x <flag>' to search for messages with a flag (seen, answered,
flagged) and '-X <flag>' to search for messages without a flag.
2020-07-25 08:08:08 +02:00
Andrew Jeffery 126c9437e8 Only send directory info once from maildir
The directory info only needs to be sent once for all the messages, this
reduces unnecessary messages being sent which could lock up the ui.
2020-07-19 11:16:05 +02:00
Reto Brunner 8446d48664 run go fmt 2020-07-17 17:50:24 +02:00
Lyudmil Angelov cc44027545 Make it easier to debug date parsing errors
When message dates failed to parse, the error displayed would try to
include the time object it failed to obtain, which would display as
something like 0001-01-01 00:00:00 UTC, which isn't of much help.

Instead, display the text we were trying to parse into a date, which
makes the problem easier to debug.
2020-07-11 13:51:32 +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
Reto Brunner 3e6189f243 notmuch: fix docstring 2020-07-08 01:02:46 +02:00
Reto Brunner 5f9c005872 notmuch: handle the answered flag 2020-07-05 15:40:12 +02:00
Srivathsan Murali 6c4ed3cfe2 notmuch: undefined variable when setting reply flag 2020-05-26 11:18:11 -04:00
Srivathsan Murali b1eb7ad18d Set AnsweredFlag on successful reply 2020-05-25 11:29:53 -04:00
Reto Brunner bae678e8f2 imap: Remove FetchMessageBodyPart.{Encoding,Charset}
Fixes https://todo.sr.ht/~sircmpwn/aerc2/352 exactly as suggested by emersion.
2020-05-16 20:03:42 +02:00
Reto Brunner fefb08f831 maildir: remove read handling from FetchMessageBodyPart 2020-05-11 09:47:21 -04:00
Reto Brunner ee1d971554 notmuch: remove read handling from FetchMessageBodyPart 2020-05-11 09:47:19 -04:00
elumbella d1600e4666 Guess date from received if not present 2020-05-06 10:00:33 -04:00
Grégoire Delattre 9a520c4098 Allow maildir subdirectories 2020-05-05 19:18:26 +02:00
Ben Fiedler 05fa79eb8e store.FetchFull: Change callback type to expose entire message
This is a prerequisite for allowing the FetchFull message to return both
the message content and the message headers.
2020-05-01 11:10:08 -04:00
Ben Fiedler 92f59ef94a imap/fetch.go: report error when fetching headers fails
Correct me if I'm wrong, but shouldn't this raise an error when it
fails?
2020-04-24 12:59:21 -04:00
Jeffas 08eabef17d Count recent messages in maildir exists total too 2020-03-09 09:13:46 -04:00
Amir Yalon ae7595e945 Ignore missing message part in getDecodedPart
The code that calls this function handles nil without issues.
2020-03-09 09:12:33 -04:00
Drew DeVault f3158b36f1 Initial support for PGP decryption & signatures 2020-03-03 16:49:52 -05:00
Simon Ser f3535703b0 worker/imap: rely on go-imap for charset handling
Set imap.CharsetReader so that go-imap can automatically decode all
encoded fields.
2020-03-03 16:48:00 -05: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 979da6d6f7 notmuch: emit dirinfo upon label change 2020-03-01 11:58:39 +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 fb2df7e169 notmuch: align dirInfo logic to the maildir worker 2020-02-29 13:16:33 -05:00
Jeffas e8b7b3bcc1 Cleanup sorting logic
There was an unused error value as well as unnecessary usage of the sort
interface. There should now be less copying so a bit better performance
in some cases.
2020-02-28 20:54:14 -05:00
Jeffas 01c96e78df Update DirectoryInfo handling for maildir
This ensures that the directory info is up to date on events in the
maildir worker. This also sets up the initial dirinfo for other
directories and updates them when using built-in commands.

FS events are still only watched for the selected directory. This should
be changed in a future patch to watch other directories too in order to
cover UI updates for folders when an event occurs in a non-selected
folder.
2020-02-28 09:26:17 -05:00
Jeffas d6696f34b8 Make search more lenient
When we fail to read a single message we don't need to fail the whole
search, just log the error and we can still get results back.
2020-02-26 21:46:35 +01:00
Jeffas 00ed2ef06a Add missing notmuch build tags 2020-02-26 21:46:31 +01:00
Galen Abell 5ba1569734 Ensure new directory exists before unwatching old 2020-02-25 16:36:37 -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 78dd043057 notmuch: refresh dirlist in background 2020-02-16 10:41:19 -05:00
Reto Brunner 8d216ab10e notmuch: add internal event loop 2020-02-16 10:41:18 -05:00
Reto Brunner bb09694f07 notmuch: emit DirInfo upon request 2020-02-16 10:41:18 -05:00
Reto Brunner 89b742dc6c Request DirInfo whenever the unread count may have changed
Actions such as read / unread or the addition of new messages do change
the read/unread/recent count. Hence we request an update from the workers.
Workers going over the network should probably cache the information and invalidate
it only if necessary
2020-02-16 10:41:17 -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
Reto Brunner 3e7e236f50 notmuch: avoid stale DBs
Opening a notmuch DB gives you a snapshot of the stage at that specific time.
Prior to this, we only reopened the DB upon writing.
However, if say a mail sync program like offlineimap is fetching new mail,
we would never pick it up.

This commit caches a db for a while, so that we don't generate too much overhead
and does a reconnect cycle after that.

I hardcoded a value as I don't think that having an option would be beneficial.
Any write operation (meaning reading mail) anyhow flushes the DB by necessity.
(we need to close to commit tag changes, which changing the read state is)
2020-02-16 10:41:10 -05:00
Timmy Douglas 8c8096da97 worker/lib/parse: be more tolerant with parsing email addresses 2020-02-06 14:38:55 -05:00
Reto Brunner df5d9a3ec7 imap: emit messageinfo when changing read state.
We need to emit the changed msgInfo whenever we modify the state
2020-01-24 10:51:09 -05:00
Reto Brunner 472c421e85 worker/imap: don't decode in FetchFullMessage.
Doing that breaks `git am` as it expected the encoded variant.
Same is probably true for any sort of signature validation (gpg / dkim)
2020-01-18 19:00:02 -05:00
Reto Brunner da6fb1a155 maildir/notmuch: don't re-encode readers 2020-01-05 16:02:46 -05:00
Reto Brunner 3d85f75d9c imap: decode reader prior to returning them 2020-01-05 16:02:45 -05:00
Reto Brunner 9096049f75 FetchBodyParts: decode source in the workers
Previously the workers returned a mixture of decoded / encoded parts.
This lead to a whole bunch of issues.
This commit changes the msgviewer and the commands to assume parts to already
be decoded
2020-01-05 16:02:45 -05:00
Reto Brunner 63391b7dca Add labels to index format (%g)
Exposes the notmuch tags accordingly, stubs it for the maildir worker.
2019-12-27 10:20:29 -07:00
Reto Brunner 40ceee969b notmuch: emit LabelList event 2019-12-21 11:20:11 -05:00
Reto Brunner 2705d8460d add LabelList event 2019-12-21 11:20:11 -05:00
Leszek Cimała e84e402e48 decode(RFC 2047) imap headers to fix encoding in subject & filenames
Me again,
this time fixing encoding of subjects and attachments. It was problem in
IMAP backend. While other backends user MessageInfo() function which
generates MessageInfo decoded via go-message methodes, IMAP worker is
creating MessageInfo directly, so all non-utf8 subjects and filenames
were in raw form.

This patch fixes it. Not sure if we should care about errors (if
DecodeHeader fails it returns raw string back).

>From what I see, this should solve all encoding problem (tested only
IMAP). So, now I can focus on features. ;-)

Have a great weekend!
Leszek
2019-12-07 14:30:33 -05:00
Srivathsan Murali 59c24523af Parse Reply-To header while parsing envelope 2019-11-17 13:24:23 -05:00
Kevin Kuehler 8a848303fe worker/imap: Fix seqMap race condition
When deleting a message, sometimes FetchDirectoryContents will fire.
FetchDirectoryContents will return a smaller set of UIDs since messages
have been deleted. This operation races with fetching from the seqMap in
client.ExpungeUpdate. Only recreate the seqMap if it can grow so that
messages will continue to be expunged.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-11-10 17:19:23 -05:00