aboutsummaryrefslogtreecommitdiffstats
path: root/worker/maildir/message.go
Commit message (Collapse)AuthorAgeFilesLines
* maildir: fix sorting by sizeKoni Marti2023-05-161-8/+26
| | | | | | | | | | | Retrieve message size not only in the MessageInfo but also in the MessageHeaders function. The MessageHeaders function is used for an memory-optimized maildir sorting. This fixes sorting by size in the maildir backend. Fixes: f04d83e8 ("messageinfo: report message sizes") Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* messageinfo: report message sizesKoni Marti2023-04-261-1/+14
| | | | | | | Report sizes of the message across all backends. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* model: change flags array to bitmaskRobin Jarry2023-01-041-2/+2
| | | | | | | Using a list of integers is not optimal. Use a bit mask instead. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* maildir: keep less data in memory for sortingTim Culverhouse2022-11-061-0/+6
| | | | | | | | | | | | | | | | Sorting opens and reads portions of every file within a directory in order to gather the data needed. Specifically, RFC822Headers and BodyStructure are not needed. The RFC822Headers field stores a lot of information, and the BodyStructure field requires parsing the body of the email. Don't set these two values when parsing. Note: in my testing, this dropped sorting a 52k archive from 2.2gb of ram usage, to < 500mb Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: move common maildir code out of workerJulian Pidancet2022-10-271-39/+1
| | | | | | | | | This change moves code that could be common to both notmuch and maildir workers in worker/lib. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* charset: handle unknown charsets more user-friendlyKoni Marti2022-09-251-2/+1
| | | | | | | | | Do not throw an error when the charset is unknown; the message entity can still be read, but log the error instead. Reported-by: falsifian Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: work nicely with wrapped errors (errorlint)Moritz Poldrack2022-08-041-2/+2
| | | | | | | | Error wrapping as introduced in Go 1.13 adds some additional logic to use for comparing errors and adding information to it. Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir,notmuch: avoid leaking open filesNguyễn Gia Phong2022-01-191-7/+2
| | | | | | | | | | Previously, Message.NewReader returned the wrapped buffered reader without a reference to the opened file, so the files descriptors were left unclosed after reading. Now, the file reader is returned directly and closed on the call site. Buffering is not needed here because it is an implementation detail of go-message. Fixes: https://todo.sr.ht/~rjarry/aerc/9
* go.mod: change base git urlRobin Jarry2021-11-051-2/+2
| | | | | | | I'm not sure what are the implications but it seems required. Link: https://github.com/golang/go/issues/20883 Signed-off-by: Robin Jarry <robin@jarry.cc>
* maildir: don't read the full file into memoryReto Brunner2021-02-081-8/+2
|
* Add additional flagging functionalityARaspiK2020-07-081-25/+11
| | | | | | | | | | | | | | 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.
* Set AnsweredFlag on successful replySrivathsan Murali2020-05-251-0/+20
|
* Mark sent messages as "seen" in maildirGalen Abell2020-03-031-4/+23
| | | | | | | - 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
* Add labels to index format (%g)Reto Brunner2019-12-271-0/+4
| | | | Exposes the notmuch tags accordingly, stubs it for the maildir worker.
* Extract message parsing to common worker moduleReto Brunner2019-08-081-220/+16
| | | | | | | Things like FetchEntityPartReader etc can be reused by most workers working with raw email files from disk (or any reader for that matter). This patch extract that common functionality in a separate package.
* Fix header decodingBen Burwell2019-07-171-13/+16
| | | | | | | | | | | | | Email headers can be encoded with different charsets, which is signalled using a special character sequence. The go-message package provides two different methods for accessing header values, Get(key) (actually inherited from the embedded textproto.Header) which returns the raw header value and Text(key), which returns the header's value decoded as UTF-8. Before, in the maildir backend, we were using the Get method which sometimes resulted in encoded headers being displayed in the UI. This patch replaces the incorrect usage of Get() with Text().
* Add maildir backend workerBen Burwell2019-07-121-0/+322
Add the initial implementation of a backend for Maildir accounts. Much of the functionality required is implemented in the go-message and go-maildir libraries, so we use them as much as possible. The maildir worker hooks into a new maildir:// URL scheme in the accounts.conf file which points to a container of several maildir directories. From there, the OpenDirectory, FetchDirectoryContents, etc messages work on subdirectories. This is implemented as a Container struct which handles mapping between the symbolic email folder names and UIDs to the concrete directories and file names.