about summary refs log tree commit diff stats
path: root/worker
Commit message (Collapse)AuthorAgeFilesLines
* format: reformat code with go 1.17Robin Jarry2021-12-117-7/+14
| | | | | | | | There was a change in how build tags are formatted. Use this as new reference. Link: https://go.dev/doc/go1.17#gofmt Signed-off-by: Robin Jarry <robin@jarry.cc>
* imap: fix build on macosRobin Jarry2021-12-111-7/+2
| | | | | | | | | | | | Fix the following build error on mac os: worker/imap/worker.go:368:29: undefined: syscall.TCP_KEEPCNT worker/imap/worker.go:376:29: undefined: syscall.TCP_KEEPINTVL These symbols are not defined on darwin. Fixes: 5dfeff75f368 ("imap: add tcp connection options") Signed-off-by: Robin Jarry <robin@jarry.cc>
* imap: add tcp connection optionsRobin Jarry2021-12-071-0/+102
| | | | | | Allow fine tuning tcp connection options. Signed-off-by: Robin Jarry <robin@jarry.cc>
* imap: use low level tcp connectionRobin Jarry2021-12-071-6/+22
| | | | | | | | | | In preparation for tcp keepalive options, we need access to the net.TCPConn object associated with an IMAP connection. The only way to do this is to create the connection ourselves. No functional change. Signed-off-by: Robin Jarry <robin@jarry.cc>
* imap: move connect procedure into a dedicated functionRobin Jarry2021-12-071-45/+55
| | | | | | | This will prepare for extra tcp connection options support and for automatic reconnect. No functional change. Signed-off-by: Robin Jarry <robin@jarry.cc>
* maildir: watch for message renamesRobin Jarry2021-12-061-2/+5
| | | | | | | | | | Messages flags can also be changed without changing directories. Changing flags in maildirs means renaming the message files. Also take renames into account. Link: https://cr.yp.to/proto/maildir.html Fixes: f4d3c8fc77f9 ("maildir: watch for external changes") Signed-off-by: Robin Jarry <robin@jarry.cc>
* maildir: watch for external changesRobin Jarry2021-12-061-4/+12
| | | | | | | | | | | | | | When a maildir is synchronized by an external process while aerc is running (e.g. mbsync), some emails may be moved out of "new" to "cur" or completely deleted. These deletions are ignored and aerc may assume these messages are still here, leading to errors. Take file deletions into account. Also, add "cur" to the watched folders since these can be modified as well. Signed-off-by: Robin Jarry <robin@jarry.cc>
* imap: fix segfault when disconnectingRobin Jarry2021-11-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | Do not set client = nil, it breaks almost all message handlers: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8c7e51] goroutine 25 [running]: git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleListDirectories worker/imap/list.go:32 git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleMessage worker/imap/worker.go:174 git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).Run worker/imap/worker.go:264 created by git.sr.ht/~rjarry/aerc/widgets.NewAccountView widgets/account.go:85 +0x518 Simply leave the disconnected client object, it already returns explicit error messages. Fixes: e41ed82cf3db ("imap: add manual {dis,}connect support") Signed-off-by: Robin Jarry <robin@jarry.cc>
* notmuch: allow sort by file orderKalyan Sriram2021-11-131-1/+3
| | | | | | | | | | | | When using the notmuch backend, it often makes more sense to sort folders (actual virtual folders, or queries) by the order specified in the query-map file, rather than alphabetically. This patch introduces a configuration option (disabled by default) that allows this. Additionally, due to the notmuch backend previously using maps (which are order-undefined) to store the list of queries, default query selection on aerc startup fluctuated. This patch fixes that by using slices to store query order.
* notmuch: allow empty searchesKalyan Sriram2021-11-131-1/+4
| | | | | Don't error on empty search terms, just don't filter by anything and return all items matching the current querymap
* messages: allow displaying email threadsy0ast2021-11-138-13/+439
| | | | | | | | | | | | | Display threads in the message list. For now, only supported by the notmuch backend and on IMAP when the server supports the THREAD extension. Setting threading-enable=true is global and will cause the message list to be empty with maildir:// accounts. Co-authored-by: Kevin Kuehler <keur@xcf.berkeley.edu> Co-authored-by: Reto Brunner <reto@labrat.space> Signed-off-by: Robin Jarry <robin@jarry.cc>
* imap: add manual {dis,}connect supportRobin Jarry2021-11-051-2/+14
| | | | Signed-off-by: Robin Jarry <robin@jarry.cc>
* go.mod: change base git urlRobin Jarry2021-11-0523-45/+45
| | | | | | | 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>
* imap: use builtin idle supportRobin Jarry2021-11-022-7/+2
| | | | | | | go-imap supports IDLE since 1.2.0. Remove dependency to go-imap-idle. Link: https://github.com/emersion/go-imap/commit/ac3f8e195ef1b6d Signed-off-by: Robin Jarry <robin@jarry.cc>
* maildir: track the recent flag correctlyReto Brunner2021-11-012-31/+55
| | | | | | | | In the maildir worker we manually need to track the Recent flag in order for the notification command etc to work. Push that responsibility to the container, we must make sure to manually add the flag though if one grabs the message info.
* notmuch/maildir: remove double emit of the dirinfoReto Brunner2021-04-282-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was some bug which could be worked around by double emitting an event. However that proofed to be brittle: We send the first message here from the worker goroutine: https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/maildir/worker.g= o#L306 Then Tick() is waked in the main goroutine and calls ProcessMessage: https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/widgets/account.go#L100 ProcessMessage in the main goroutine reads types.Message state with msg.getId() and msg.InResponseTo(): https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/types/worker.go#= L74-76 Meanwhile in the worker goroutine we call PostMessage for a second time with a pointer that points to the *same* previous message that ProcessMessage is reading: https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/maildir/worker.g= o#L306 The second PostMessage call makes writes to message while ProcessMessage in the main goroutine is possibly reading: https://git.sr.ht/~sircmpwn/aerc/tree/a5553438/item/worker/types/worker.go#= L59 This led to a data race in the event loop Reported-By: Wagner Riffel <w@104d.net>
* lib/parse: simplify parseAddressListReto Brunner2021-02-221-13/+5
|
* maildir: don't read the full file into memoryReto Brunner2021-02-081-8/+2
|
* notmuch: don't read the full file into memoryReto Brunner2021-02-081-9/+3
|
* notmuch: trim excluded tagsKalyan Sriram2020-12-021-0/+3
| | | | | Trims whitespace in list of excluded notmuch tags. This allows a comma separated list with spaces to be correctly processed.
* notmuch: remove gc close hooksReto Brunner2020-12-021-0/+1
| | | | | | | We frequently had issues with notmuch segfaulting and my guess is that this was due to the garbage collection magic used in the module. This changes to a fork that ripped the functionality out.
* imap: strip <> from message-idsReto Brunner2020-11-141-1/+9
|
* lib/parse: use go-message msgid parsing if it succeedsReto Brunner2020-11-141-2/+6
|
* remove models.Address in favor of go-message AddressReto Brunner2020-11-143-13/+15
| | | | | | | 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
* imap: add sort supportReto Brunner2020-10-112-3/+50
|
* notmuch: rename method to SetFlagReto Brunner2020-09-272-5/+5
|
* notmuch: close tag objectReto Brunner2020-09-241-0/+1
|
* handle message unknown charset errorJeff Martin2020-08-313-2/+99
| | | | | | | | | | | | | | 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.
* base models.Address on the mail.Address typeReto Brunner2020-08-203-14/+3
| | | | | | | | | | | | 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.
* Add support for :rmdirARaspiK2020-08-195-0/+41
| | | | | | | | | | | | | | | | | | | | | 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.
* improve date parsing for notmuch/maildirReto Brunner2020-08-101-24/+49
| | | | | | | | | | | | | | | | | | | | 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.
* notmuch: manually close notmuch objectsReto Brunner2020-08-071-0/+3
| | | | | There seems to be some race with the automatic closing that should happen in theory... close it manually where we can to avoid the issue
* maildir: Provide nicer error message on invalid urlTero Koskinen2020-07-272-4/+34
| | | | | | | | 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.
* Remove hard coded bodystruct path everywhereReto Brunner2020-07-272-7/+11
| | | | | | | 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.
* Add flag based search optionsTobias Wölfel2020-07-252-2/+42
| | | | | | | 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.
* Only send directory info once from maildirAndrew Jeffery2020-07-191-4/+5
| | | | | 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.
* run go fmtReto Brunner2020-07-171-2/+2
|
* Make it easier to debug date parsing errorsLyudmil Angelov2020-07-111-1/+1
| | | | | | | | | 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.
* Add additional flagging functionalityARaspiK2020-07-087-91/+76
| | | | | | | | | | | | | | 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.
* notmuch: fix docstringReto Brunner2020-07-081-1/+1
|
* notmuch: handle the answered flagReto Brunner2020-07-051-0/+2
|
* notmuch: undefined variable when setting reply flagSrivathsan Murali2020-05-261-1/+1
|
* Set AnsweredFlag on successful replySrivathsan Murali2020-05-257-0/+155
|
* imap: Remove FetchMessageBodyPart.{Encoding,Charset}Reto Brunner2020-05-162-110/+109
| | | | Fixes https://todo.sr.ht/~sircmpwn/aerc2/352 exactly as suggested by emersion.
* maildir: remove read handling from FetchMessageBodyPartReto Brunner2020-05-111-21/+0
|
* notmuch: remove read handling from FetchMessageBodyPartReto Brunner2020-05-111-13/+0
|
* Guess date from received if not presentelumbella2020-05-061-1/+41
|
* Allow maildir subdirectoriesGrégoire Delattre2020-05-051-11/+27
|
* store.FetchFull: Change callback type to expose entire messageBen Fiedler2020-05-011-0/+1
| | | | | This is a prerequisite for allowing the FetchFull message to return both the message content and the message headers.
* imap/fetch.go: report error when fetching headers failsBen Fiedler2020-04-241-3/+4
| | | | | Correct me if I'm wrong, but shouldn't this raise an error when it fails?