aboutsummaryrefslogtreecommitdiffstats
path: root/worker/maildir
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>
* maildir: fix FSWatcher handling of eventsTim Culverhouse2023-05-111-40/+22
| | | | | | | | | | | | | | | | | | | | Commit ef4504e6baf5 ("maildir: fix handling of FSEvents") ambitiously tried to fix handling of file system events by handling different events in "proper" ways. Distributions and OSes report these FSEvents differently which creates a large amount of edge cases on what the right handling of each individual event should be. Revert part of ef4504e6baf5 which attempts to issue different messages based on the event. Add a debounce to file system events and always trigger a Refetch of the message list. This still fixes one of the "fixes" the referenced patch attempted at, where the UI was only told to refetch if the message count increased (but if messages disappeared externally, the maildir never updated). Fixes: ef4504e6baf5 ("maildir: fix handling of FSEvents") Reported-by: Kirill Chibisov <contact@kchibisov.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Kirill Chibisov <contact@kchibisov.com>
* maildir: fix handling of FSEventsTim Culverhouse2023-04-282-8/+44
| | | | | | | | | | | | | | | | | | | Maildir uses a filesystem watcher to watch the currently selected directory for changes, updating the UI as necessary. Not all changes get updated based on the current logic. Send a MessageInfo if the event was a Rename. Send a MessagesDeleted if the event was a Remove. Tell the UI to refetch the list if the event was a Create. Note: This leads to some unnecessary fetching in the UI, as renames also come with a Create event in most cases. Koni suggested sending the MessageInfo and having the UI perform a binary search and inserting the message in the proper position. This is optimization is left out of this series, with a TODO left in the code. Fixes: https://todo.sr.ht/~rjarry/aerc/171 Fixes: 91ac21ac6155 ("msgstore: fetch message list based on OpenDirectory msg") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* 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>
* search: handle headers in search/filter queryJulian Marcos2023-04-221-1/+7
| | | | | | | | | Handle headers in the search and filter commands, for searching and filtering based on the Headers specified by the -H parameter, the syntax for the -H parameter should be `Header: Key`. Signed-off-by: Julian Marcos <jmjl@tilde.green> Acked-by: Robin Jarry<robin@jarry.cc>
* directory: use directory to store rue countsTim Culverhouse2023-04-221-6/+1
| | | | | | | | | | | | Store the Directory RUE counts on the Directory data model. Use DirectoryInfo messages to update the Directory model. Access Directories via the dirlist instead of via the msgstore. Remove unused fields on DirectoryInfo, all backends now give accurate counts. Move refetch logic into dirlist Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* directory: remove attributes fieldTim Culverhouse2023-04-221-2/+1
| | | | | | | Remove the unused field Attributes Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* capabilities: report capabilities from backendTim Culverhouse2023-04-221-7/+22
| | | | | | | | | | | | | Use the Backend interface to report Backend capabilities. Previously, these were reported via a DirectoryInfo message, however they have nothing to do with a directory and should be reported directly by the backend. Add Capabilities method to Backend interface, satisfy this in each backend, and use it on the UI side. Remove Caps field from DirectoryInfo Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry<robin@jarry.cc>
* msgstore: fetch message list based on OpenDirectory msgTim Culverhouse2023-04-221-3/+9
| | | | | | | | | | | | | | | Fetching the message list is done in a convoluted way. The UI receives a DirectoryInfo message, which creates a message store. It then receives a second DirectoryInfo (an oddity from the IMAP worker), and this DirectoryInfo is passed to the message store which then requests a fetch of the message list via store.Sort. Use the OpenDirectory done response to tell the message store to fetch messages. This makes the code easier to follow, and does not rely on quirks from the IMAP worker. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* fswatcher: add a darwin fswatcher implementationTim Culverhouse2023-03-071-0/+4
| | | | | | | | | | Add a darwin implementation of FSWatcher using the fsevents package. The implementation is behind a darwin build flag. Co-authored-by: Ben Cohen <ben@bencohen.net> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Ben Lee-Cohen <ben@lee-cohen.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: use FSWatcher interfaceTim Culverhouse2023-03-071-13/+5
| | | | | | | | Use the FSWatcher interface to create the watcher. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Ben Lee-Cohen <ben@lee-cohen.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: add missing panic handlers in goroutinesRobin Jarry2023-01-062-0/+5
| | | | | | | | These issues were all reported by the new custom analyzer introduced in previous commit. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* model: change flags array to bitmaskRobin Jarry2023-01-042-4/+4
| | | | | | | 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: send MessagesDeleted to UI when moving messagesTim Culverhouse2022-12-141-0/+4
| | | | | | | | | | | | | | The maildir worker sends a MessagesMoved message to the UI when messages are moved, enabling the destination directory to update it's counts. The filesystem watcher sees the move and updates the directory currently selected. However, an update of the UIDs in the msgstore is not completed as it is in other workers. All other works, via some mechanism (direct or EXPUNGE update) issue a MessagesDeleted message after a move. Send this message to the UI for the maildir worker to have it work as all other workers do. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* maildir: filter and search with a date rangeKoni Marti2022-12-021-6/+38
| | | | | | | Filter and search with a date range in the maildir backend. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: rename package to logRobin Jarry2022-12-022-41/+41
| | | | | | | | | | Use the same name than the builtin "log" package. That way, we do not risk logging in the wrong place. Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* logging: homogenize levelsRobin Jarry2022-12-022-11/+12
| | | | | | | | | | | | | | | | | | The main goal is to ensure that by default, the log file (if configured) does not grow out of proportions. Most of the logging messages in aerc are actually for debugging and/or trace purposes. Define clear rules for logging levels. Enforce these rules everywhere. After this patch, here is what the log file looks like after starting up with a single account: INFO 2022/11/24 20:26:16.147164 aerc.go:176: Starting up version 0.13.0-100-g683981479c60 (go1.18.7 amd64 linux) INFO 2022/11/24 20:26:17.546448 account.go:254: [work] connected. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* maildir: drain limit channel on parse error when sortingTim Culverhouse2022-11-091-0/+1
| | | | | | | | | | | | | | Commit 155f0c3f28a1 ("maildir/sort: get MessageInfos in parallel") added parallel parsing of maildir messages. The parsing is limitted to 2x the number of CPUs using a buffered channel. The channel is drained at the end of the parsing, however it is not drained if a parse error is encountered. With enough errors, this can lead to a deadlock. Drain the channel when an error occurs. Fixes: 155f0c3f28a1 ("maildir/sort: get MessageInfos in parallel") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: always sort by at least uidTim Culverhouse2022-11-091-1/+7
| | | | | | | | | | | | | | | | | | | | Commit 29205fdd07c0 ("maildir/search: get MessageInfos in parallel") introduced parallel searching of maildir backends, which improves search and filtering performance. When no filter is specified, the search algorithm is still used with no criteria because the FilterCriteria field always contains "filter" as a minimum. With the new parallelized search, the message order becomes random. Only use the search algorithm if there is a filter specified. If a filter *is* specified and a sort order is *not*, the messages will go through the search algorithm and become randomized, but not sorted back in order. Always default to a UID order sort (the same as prior to this commit) when no sort order is specified. Fixes: 29205fdd07c0 ("maildir/search: get MessageInfos in parallel") Reported-by: Ben Lee-Cohen <bdc@fastmail.fm> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Ben Lee-Cohen <bdc@fastmail.fm>
* maildir: enable backend threadsTim Culverhouse2022-11-091-1/+85
| | | | | | | | | | Add thread capability to maildir backend. Enables the maildir worker to thread the entire folder, as opposed to only the displayed messages via client side threads. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: speedup move to larger foldersBence Ferdinandy2022-11-091-7/+4
| | | | | | | | | | When moving or archiving to a very large folder, aerc requests directory info, which can takes several seconds to receive. Also, when moving, we post a MessagesDeleted message. Remove unnecessary call to directory info and change posted message to the correct MessagesMoved. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* maildir: keep less data in memory for sortingTim Culverhouse2022-11-062-1/+19
| | | | | | | | | | | | | | | | 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/search: get MessageInfos in parallelTim Culverhouse2022-11-061-8/+23
| | | | | | | | Searching in the maildir worker requires reading each file in the directory. Use waitgroups and goroutines to read files in parallel. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir/sort: get MessageInfos in parallelTim Culverhouse2022-11-061-6/+22
| | | | | | | | Sorting in the maildir worker requires reading each file in the directory. Use waitgroups and goroutines to read files in parallel. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: set SkipSort when checking mailTim Culverhouse2022-11-061-1/+2
| | | | | | | | | | | | | The maildir worker's check-mail command did not include the SkipSort directive in the DirectoryInfo, which would cause a fresh fetching of directory contents on the selected maiboxes. This is unneeded and resulted in every directory being sent to the msgstore and requesting a sort. Set SkipSort when checking mail to prevent extra calls to sort. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: replace ListFolder method with FolderMapJulian Pidancet2022-10-271-5/+5
| | | | | | | | | | | Replace ListFolder with a new method that returns a map indexed by folder names instead of a list of folder names. A map is simpler to use and more efficient in case we only want to check the presence of a specific folder in the Maildir store. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* maildir: move common maildir code out of workerJulian Pidancet2022-10-273-143/+19
| | | | | | | | | 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>
* maildir: fix maildir folder listingJulian Pidancet2022-10-251-1/+1
| | | | | | | | | | | | | | | Previous change "maildir: hide invalid folders" prevents filepath.Walk from descending into directories that don't contain new/, tmp/ or cur/ because the WalkDirFunc returns filepath.SkipDir. We have to assume that these directories can be the parent of valid maildir folders even if they're not themselves valid maildir folders, so it is a mistake not to recurse into these subfolders. Fix it by returning nil instead of filepath.SkipDir in the WalkDirFunc. Fixes: 150aa0f498b9 ("maildir: hide invalid folders") Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: make checkmail update directory countsBen Cohen2022-10-181-0/+14
| | | | | | | | Non-selected folders will now have their total/unread/new counts updated in the background when a check-mail happens. Signed-off-by: Ben Cohen <ben@bencohen.net> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: hide invalid foldersJulian Pidancet2022-10-031-0/+7
| | | | | | | | | | | | | | | | | The maildir worker currently populates the list of mail folders by listing all the filesystem subdirectories in the maildir directory. Although there's no official specification for maildir subfolders, they should all have cur/ new/ and tmp/ subdirectories to be valid. This patch prevents directories that don't have those subdirectories present on the filesystem from appearing in the account folder list. This is useful for example to prevent ".notmuch" and ".notmuch/xapian" from showing up in the folder list if using notmuch to index emails while using aerc's maildir backend. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* logging: substitute %w for %vKoni Marti2022-10-021-28/+28
| | | | | | | | | | | | | | | | Subsitute the format specifier %w for %v in the logging facility. The logging functions use a fmt.Sprintf call behind the scene which does not recognize %w. %w should be used in fmt.Errorf when you want to wrap errors. Hence, the log entries that use %w are improperly formatted like this: ERROR 2022/10/02 09:13:57.724529 worker.go:439: could not get message info %!w(*fmt.wrapError=&{could not get structure: [snip] }) ^ Links: https://go.dev/blog/go1.13-errors Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* backends: send MessageInfoError on header fetching errorTim Culverhouse2022-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | When an error is encountered fetching a header, the backends respond with a type.Error worker message. On receipt of this message, the UI deletes all pending headers. The headers are all requested again as they remain on the screen, resulting in an infinite request loop - and an infinite logging loop. The user only ever sees the spinner unless they check the logs. A previous commit intended to fix this, however it introduced a regression where any message that was part of the fetch request would also be marked as erroneous. This commit is reverted with commit 2aad2fea7d36 ("msgstore: revert 9fdc7acf5b48"). Send an erroneous message info message from the backend when an error is encountered for a specific UID. Fixes: 01f80721e283 ("msgstore: post MessageInfo on erroneous fetch") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* 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>
* maildir: do not send dircontents on fs eventTim Culverhouse2022-08-301-13/+0
| | | | | | | | | | | | | | The maildir worker watches the file system for events (new mail, moved mail, copied mail, etc). On an event, the worker sends a DirectoryContents message and a DirectoryInfo message. Do not send DirectoryContents on FS Event in the maildir worker. The DirectoryInfo message already triggers the UI to request the new DirectoryContents, and does so in a more predictable way (IE any currently applied filter is applied). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: remove filename encoded UID when moving messagesTim Culverhouse2022-08-241-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | The built-in maildir.Dir.Move method performs an OS level file rename, which allows for preserving file creation time. Commit c98f70487417 ("move: enable MoveMessages from msgstore") enabled the use of the Move method for maildir. One particular maildir synchronizer (isync/mbsync) encodes the UID within the filename of the email and cannot recover if the UID is preserved during a move. mbsync encodes filenames like so: /path/to/email/{maildir-key},U={uid}:2,S OfflineIMAP encodes the UID within the filename, but also encodes a hash of the originating folder so that it can recover from a move without a rename of the underlying file. OfflineIMAP encodes like so: /path/to/email{maildir-key},U={uid},FMD5={folder-hash}:2,S Remove encoded UIDs of the form `,U={uid}` from filenames to prevent sync issues. Fixes: https://todo.sr.ht/~rjarry/aerc/75 Fixes: c98f70487417 ("move: enable MoveMessages from msgstore") Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: implement MoveMessages handlingTim Culverhouse2022-08-222-0/+36
| | | | | | | | | | | | | Implement MoveMessages in the maildir worker. go-maildir supports Move operations by default, and is functionally equivalent to a OS-level rename. Creation date of the file is preserved by using Move, which is used by at least one maildir-to-IMAP synchronizer (isync/mbsync). The previous move method of copy-and-delete would reset the creation date of the message, and potentially cause sorting issues in other email clients. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* go: removed io/ioutilMoritz Poldrack2022-08-222-5/+4
| | | | | | | | | | Since the minimum required version of Go has been bumped to 1.16, the deprecation of io/ioutil can now be acted upon. This Commit removes the remaining dependencies on ioutil and replaces them with their io or os counterparts. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: work nicely with wrapped errors (errorlint)Moritz Poldrack2022-08-043-45/+45
| | | | | | | | 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>
* lint: homogenize operations and minor fixes (gocritic)Moritz Poldrack2022-08-043-8/+11
| | | | | | | | | | | | | | | | | | Apply GoDoc comment policy (comments for humans should have a space after the //; machine-readable comments shouldn't) Use strings.ReplaceAll instead of strings.Replace when appropriate Remove if/else chains by replacing them with switches Use short assignment/increment notation Replace single case switches with if statements Combine else and if when appropriate Signed-off-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
* lint: apply new formatting rulesMoritz Poldrack2022-08-013-9/+16
| | | | | | | Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* checkmail: error if check-mail-cmd is not setTim Culverhouse2022-08-011-0/+4
| | | | | | | Send error message to UI if check-mail-cmd is required but not set. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* logging: use level-based logger functionsRobin Jarry2022-07-233-46/+44
| | | | | | | | | | | | Do not pass logger objects around anymore. Shuffle some messages to make them consistent with the new logging API. Avoid using %v when a more specific verb exists for the argument types. The loggers are completely disabled (i.e. Sprintf is not even called) by default. They are only enabled when redirecting stdout to a file. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* account: import mbox file to a folderKoni Marti2022-07-141-1/+3
| | | | | | | | | | | | | Append all messages from an mbox file to the selected folder with the import-mbox command. User confirmation is required when the folder already contains messages. A failed append will be retried a few times. If a backend timeout occurs, the entire import is stopped to prevent a hang. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* account: export folder to mbox fileKoni Marti2022-07-141-0/+3
| | | | | | | | | Export all message in the current folder to an mbox file. If an error occurs during the export, aerc retries a few times before giving up to prevent a hang. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: enable filtering of server-side threadsTim Culverhouse2022-07-101-4/+19
| | | | | | | | | | | | | | This patch enables the filtering of a threaded view which uses server-built threads. Filtering is done server-side, in order to preserve the use of server-built threads. In adding this feature, the filtering of notmuch folders was brought up to feature parity with the other workers. The filters function the same (ie: they can be stacked). The notmuch filters, however, still use notmuch syntax for the filtering. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threading: add backend capabilities to workersTim Culverhouse2022-07-101-0/+5
| | | | | | | | | | | This patch provides a method to report backend capabilities to the UI. The intial capabilities included in the report are Sort and Thread. Having these available to the UI enables the client to better handle server side threading. Signed-off-by: Koni Marti <koni.marti@gmail.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* worker/maildir: implement Maildir++ supportAdnan Maolood2022-07-102-4/+42
| | | | | | | See https://www.courier-mta.org/maildir.html#maildircontents Signed-off-by: Adnan Maolood <me@adnano.co> Acked-by: Koni Marti <koni.marti@gmail.com>
* maildir: fix dirinfo.Unseen and Exists countingTim Culverhouse2022-06-141-2/+0
| | | | | | | | The maildir worker was adding Recent messages to the counts of Unseen and Exists, however these messages were already included in those counts. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* dirlist: update RUE counts for imap/maildir on move|copy|delete|archiveTim Culverhouse2022-06-071-13/+4
| | | | | | | | | | | | | | | | | | | When moving/copying/deleting/archiving a message in imap, the RUE counts displayed in the dirlist would not update properly. Maildir has (had) an implementation that recounts the entire directory and updates the DirectoryInfo after one of these actions. This patch implements a more efficient method of updating, and also enables it to apply to IMAP without any additional requests. Upon completion of the action, the counts are manually updated with the count of messages in the action and recent and/or unseen states of those messages. This is more efficient for maildir, because we aren't counting everything in the store. For IMAP, we get the updates for free because we are only performing the update after confirmation from the server that the action has happened. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* feat: add background mail polling option for all workersTim Culverhouse2022-05-311-11/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | Check for new mail (recent, unseen, exists counts) with an external command, or for imap with the STATUS command, at start or on reconnection and every X time duration IMAP: The selected folder is skipped, per specification. Additional config options are included for including/excluding folders explicitly. Maildir/Notmuch: An external command will be run in the background to check for new mail. An optional timeout can be used with maildir/notmuch. Default is 10s New account options: check-mail check-mail-cmd (maildir/notmuch only) check-mail-timeout (maildir/notmuch only), default 10s check-mail-include (IMAP only) check-mail-exclude (IMAP only) If unset, or set less than or equal to 0, check-mail will be ignored Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>