summaryrefslogtreecommitdiff
path: root/worker/lib
AgeCommit message (Collapse)Author
2022-07-14mbox: implement an mbox backend workerKoni Marti
Implement an mbox backend worker. Worker can be used for testing and development by mocking a backend for the message store. Worker does not modify the actual mbox file on disk; all operations are performed in memory. To use the mbox backend, create an mbox account in the accounts.conf where the source uses the "mbox://" scheme, such as source = mbox://~/mbox/ or source = mbox://~/mbox/file.mbox If the mbox source points to a directory, all files in this directory with the .mbox suffix will be opened as folders. If an outgoing smtp server is defined for the mbox account, replies can be sent to emails that are stored in the mbox file. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-07parse: fix content-type parsing errorKoni Marti
If an error occurs when parsing the content-type, check if the content-type is quoted; if so, remove quotes. If this is not the case, then return a text/plain content-type as a sane fallback option, so that the message can be at least viewed in plaintext. Fixes: https://todo.sr.ht/~rjarry/aerc/44 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2022-04-25pgp: ensure CRLF line endings in pgpmail readerKoni Marti
Ensure CRLF line endings in the pgpmail reader. Fix the pgp signature verification for maildir and notmuch. These backends do not return the full message body with CRLF line endings. But the accepted OpenPGP convention is for signed data to end with a <CR><LF> sequence (see RFC3156). If this is not the case the signed and transmitted data are considered not the same and thus signature verification fails. Link: https://datatracker.ietf.org/doc/html/rfc3156 Reported-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
2022-03-18go vet: composite literal uses unkeyed fieldsMoritz Poldrack
This commit fixes all occurrences of the abovementioned lint-error in the codebase. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2022-01-19maildir,notmuch: avoid leaking open filesNguyễn Gia Phong
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
2021-11-05go.mod: change base git urlRobin Jarry
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>
2021-02-22lib/parse: simplify parseAddressListReto Brunner
2020-11-14lib/parse: use go-message msgid parsing if it succeedsReto Brunner
2020-11-14remove models.Address in favor of go-message AddressReto Brunner
We made a new type out of go-message/mail.Address without any real reason. This suddenly made it necessary to convert from one to the other without actually having any benefit whatsoever. This commit gets rid of the additional type
2020-08-31handle message unknown charset errorJeff Martin
This change handles message parse errors by printing the error when the user tries to view the message. Specifically only handling unknown charset errors in this patch, but there are many types of invalid messages that can be handled in this way. aerc currently leaves certain messages in the msglist in the pending (spinner) state, and I'm unable to view or modify the message. aerc also only prints parse errors with message when they are initially loaded. This UX is a little better, because you can still see the header info about the message, and if you try to view it, you will see the specific error.
2020-08-20base models.Address on the mail.Address typeReto Brunner
This allows us to hook into the std libs implementation of parsing related stuff. For this, we need to get rid of the distinction between a mailbox and a host to just a single "address" field. However this is already the common case. All but one users immediately concatenated the mbox/domain to a single address. So this in effects makes it simpler for most cases and we simply do the transformation in the special case.
2020-08-10improve date parsing for notmuch/maildirReto Brunner
If a message date would fail to parse, the worker would never receive the MessageInfo it asked for, and so it wouldn't display the message. The problem is the spec for date formats is too lax, so trying to ensure we can parse every weird date format out there is not a strategy we want to pursue. On the other hand, preventing the user from reading and working with a message due to the error format is also not a solution. The maildir and notmuch workers will now fallback to the internal date, which is based on the received header if we can't parse the format of the Date header. The UI will also fallback to the received header whenever the date header can't be parsed. This patch is based on the work done by Lyudmil Angelov <lyudmilangelov@gmail.com> But tries to handle a parsing error a bit more gracefully instead of just returning the zero date.
2020-07-27Remove hard coded bodystruct path everywhereReto Brunner
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-11Make it easier to debug date parsing errorsLyudmil Angelov
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-05-06Guess date from received if not presentelumbella
2020-03-03Initial support for PGP decryption & signaturesDrew DeVault
2020-02-28Cleanup sorting logicJeffas
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-06worker/lib/parse: be more tolerant with parsing email addressesTimmy Douglas
2020-01-05maildir/notmuch: don't re-encode readersReto Brunner
2019-12-27Add labels to index format (%g)Reto Brunner
Exposes the notmuch tags accordingly, stubs it for the maildir worker.
2019-11-17Parse Reply-To header while parsing envelopeSrivathsan Murali
2019-09-20Add sorting functionalityJeffas
There is a command and config option. The criteria are a list of the sort criterion and each can be individually reversed. This only includes support for sorting in the maildir backend currently. The other backends are not supported in this patch.
2019-09-04all: rewrite references to strings.Index to strings.ContainsWagner Riffel
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-08-08Extract message parsing to common worker moduleReto Brunner
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.