aboutsummaryrefslogtreecommitdiffstats
path: root/worker
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup sorting logicJeffas2020-02-281-155/+55
| | | | | | 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.
* Update DirectoryInfo handling for maildirJeffas2020-02-281-6/+50
| | | | | | | | | | | 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.
* Make search more lenientJeffas2020-02-261-1/+2
| | | | | 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.
* Add missing notmuch build tagsJeffas2020-02-262-0/+4
|
* Ensure new directory exists before unwatching oldGalen Abell2020-02-251-5/+6
|
* lib/msgstore: debounce directoryUpdateRequestsReto Brunner2020-02-251-0/+2
| | | | | | | | 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.
* notmuch: refresh dirlist in backgroundReto Brunner2020-02-163-1/+27
|
* notmuch: add internal event loopReto Brunner2020-02-163-12/+38
|
* notmuch: emit DirInfo upon requestReto Brunner2020-02-161-12/+44
|
* Request DirInfo whenever the unread count may have changedReto Brunner2020-02-161-0/+7
| | | | | | | 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
* imap: fix double closing idleStopReto Brunner2020-02-161-2/+4
| | | | | | 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.
* notmuch: avoid stale DBsReto Brunner2020-02-161-99/+133
| | | | | | | | | | | | | | 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)
* worker/lib/parse: be more tolerant with parsing email addressesTimmy Douglas2020-02-061-1/+1
|
* imap: emit messageinfo when changing read state.Reto Brunner2020-01-241-2/+17
| | | | We need to emit the changed msgInfo whenever we modify the state
* worker/imap: don't decode in FetchFullMessage.Reto Brunner2020-01-181-27/+2
| | | | | Doing that breaks `git am` as it expected the encoded variant. Same is probably true for any sort of signature validation (gpg / dkim)
* maildir/notmuch: don't re-encode readersReto Brunner2020-01-051-37/+4
|
* imap: decode reader prior to returning themReto Brunner2020-01-051-10/+90
|
* FetchBodyParts: decode source in the workersReto Brunner2020-01-051-2/+4
| | | | | | | 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
* Add labels to index format (%g)Reto Brunner2019-12-273-0/+14
| | | | Exposes the notmuch tags accordingly, stubs it for the maildir worker.
* notmuch: emit LabelList eventReto Brunner2019-12-212-0/+29
|
* add LabelList eventReto Brunner2019-12-211-0/+5
|
* decode(RFC 2047) imap headers to fix encoding in subject & filenamesLeszek CimaƂa2019-12-071-5/+25
| | | | | | | | | | | | | | | | | | 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
* Parse Reply-To header while parsing envelopeSrivathsan Murali2019-11-171-0/+5
|
* worker/imap: Fix seqMap race conditionKevin Kuehler2019-11-101-1/+3
| | | | | | | | | | 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>
* Notmuch: be resilient to config errorsReto Brunner2019-11-011-3/+22
| | | | | | | | Right now notmuch panics if something goes wrong in the configure event. This patch checks for that and returns an error instead, so that we can at least get the UI up and running (and all the other accounts) The experience will be completely degraded until another configure event occurs.
* notmuch: ignore comments and blank lines when processing query-map fileMatt Snider2019-11-011-0/+4
| | | | | A segmentation fault occurs when using the notmuch backend and a `query-map` file that contains blank lines or comments.
* Fix: oauthbearer runtime errorFrode Aannevik2019-10-161-6/+7
| | | | | | | | | | | | 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
* Change search flagsJeffas2019-09-202-4/+12
| | | | | | | | This changes the search flags for maildir and imap backends. They now no longer use -t for searching all text. This seems to make more sense as being the targeted recipient. I have similarly added Cc for -c. The text search now resides under -a for all text.
* notmuch: add sort functionalityReto Brunner2019-09-201-6/+41
|
* Add sorting functionalityJeffas2019-09-204-7/+319
| | | | | | | | 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.
* Add directory info messagesJeffas2019-09-181-16/+55
| | | | | | | This populates the directory info model properly when requested, allowing the fields to be relied upon elsewhere. This also sends the dirinfo when new messages come in.
* Add basic searching to the maildir backendJeffas2019-09-162-1/+260
| | | | | | | | | | | | | | Basic searching is supported with the following: - read messages - unread messages - from addresses - text in body - text in subject - text in all The implementation loops through all messages in the selected directory. It tries to be smart by detecting which parts of each message the search query needs to use and only loads these from the filesystem.
* notmuch: implement ModifyLabelsReto Brunner2019-09-161-26/+61
|
* notmuch: sync maildir flagsReto Brunner2019-09-161-1/+4
| | | | Syncs back special notmuch tag like unread to the underlying maildir store
* notmuch: extract all notmuch db operations.Reto Brunner2019-09-163-175/+250
| | | | | | For some reason the current code frequently segfaults due to an invalid C memory address. This commit mediates that by never keeping an object alive longer than absolutely necessary.
* Add modify-labels commandReto Brunner2019-09-121-0/+7
| | | | | This adds the event type as well as the command implementation, but no backend supports it yet.
* Add new search behaviour for imapJeffas2019-09-111-4/+19
| | | | | | This patch adds search behaviour to allow searching in the body of the messages, the entire text (body + header), and searching just the from header.
* all: rewrite references to strings.Index to strings.ContainsWagner Riffel2019-09-041-1/+1
| | | | Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
* notmuch: add search / filter capabilitiesReto Brunner2019-08-291-9/+29
|
* extract search criteria parsing into the backendsReto Brunner2019-08-293-11/+50
|
* Notmuch: use adhoc write connection.Reto Brunner2019-08-262-30/+147
| | | | | | | | Notmuch only allows a single write connection, all other clients trying to modify the db block. Hence we should only open one when we actually need it. Apparently we also need to refresh the RO DB connection upon modification, else we get stale message tag results
* imap worker: do not copy mailbox status mutexWagner Riffel2019-08-261-2/+3
| | | | Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
* maildir: Preserve flags when copying messagesBen Burwell2019-08-081-20/+2
|
* Add notmuch backendReto Brunner2019-08-083-0/+521
| | | | | | | | | | | | This commit introduces the notmuch backend. The backend is conditionally compiled in if the "notmuch" tag is provided. Most of the message types are implemented, with the notable exceptions of DeleteMessages as well as any copy / move / append type. Reason being, that those aren't normally applicable in a notmuch based workflow. Changes v2 --> v3, based on review comments * Use account config for configuration
* Extract message parsing to common worker moduleReto Brunner2019-08-082-220/+256
| | | | | | | 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.
* Don't print imap errors to uiJelle Besseling2019-08-081-0/+1
| | | | | | | | 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
* Clean maildirs when openedBen Burwell2019-08-021-0/+4
| | | | This removes old aborted deliveries from the tmp directory.
* Fix error handling in maildir workerNicolai Dagestad2019-07-191-14/+7
|
* Register worker in init.Reto Brunner2019-07-195-20/+53
| | | | | This allows backends which can't always be compiled due to missing dependencies (say libnotmuch) to be compiled conditionally with buildflags.
* maildir: Watch for new messagesBen Burwell2019-07-172-14/+73
| | | | | | | | When a directory is opened, start watching its "new" subdirectory for incoming messages using the fsnotify library. When creation events are detected, run the Unseen routine to move the message from new to cur and add new UIDs to the store, updating the UI's list of directory contents as we go.