aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* move and archive: common code for common operationBence Ferdinandy2022-11-133-44/+58
| | | | | | | | | | | | The code of Archive and Move are slightly different, even though they essentially do the same thing sans the destination and archive always creating the destination if it doesn't exist. Extract common code into a function used by both. This will also result in Move now also respecting next-message-on-delete. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: fallback when parsing for in-reply-to failsKoni Marti2022-11-131-4/+7
| | | | | | | | | | Fallback to just using the raw In-Reply-To header content when it cannot be properly parsed as a message-id. Fixes: ca903d422826 ("envelope: add InReplyTo field") Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* dirtree: fix mouse support for selecting foldersKoni Marti2022-11-131-5/+12
| | | | | | | | | Fix mouse support for selecting folders. Toggle foldable directories to expand or collapse when clicked on. Fixes: https://todo.sr.ht/~rjarry/aerc/99 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* reply: allow to override localized Re regexp in configurationjp392022-11-135-6/+25
| | | | | | | | | | | | | | | My corporate email server annoyingly adds an "[External] " prefix when delivering emails from outside my organization. I'd like to be able to automatically strip it from the subject line when replying to external emails. With this patch, I can achieve it by setting this line in my account configuration: subject-re-pattern = ^(\[External\] : )?((?i)((AW|RE|SV|VS|ODP|R): ?)+) Signed-off-by: jp39 <jp39@gmx.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* filters: export more info to filter processesRobin Jarry2022-11-134-0/+19
| | | | | | | Export some more environment variables to the pager commands. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
* msgviewer: show error if MessageInfo has errorTim Culverhouse2022-11-091-2/+9
| | | | | | | | | | | | | | | | | MessageInfo structs can be returned from the workers with parser errors. MessageViews were previously prevented from opening if the error field was not nil, however the addition of message view splits have allowed these messages to have split views created. A panic can occur if a split is open and one of these messages is scrolled over. Prevent access to MessageInfo methods if the Error field is set. Display the error to the user in the split view. The partSwitcher will be nil if an error is set: check for this condition before calling it's methods. Reported-by: Ben Lee-Cohen <ben@lee-cohen.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* dirtree: show dynamic folders properlyKoni Marti2022-11-091-0/+15
| | | | | | | | | | Show dynamic folders from notmuch queries using :cf when using the directory tree view. The current dirtree implementation would swallow the query list entry but show the folder contents correctly in the message list. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net>
* dirtree: prevent panic when no folder is foundKoni Marti2022-11-092-2/+2
| | | | | | | | | Prevent crash when no folder is found. Fixes: https://todo.sr.ht/~rjarry/aerc/100 Fixes: https://todo.sr.ht/~rjarry/aerc/101 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net>
* 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>
* style: add italic optionTim Culverhouse2022-11-092-1/+19
| | | | | | | | Add italic option to style config. Update docs. Suggested-by: inwit <inwit@sindominio.net> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* 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>
* message-info: add explicit References fieldTim Culverhouse2022-11-094-0/+17
| | | | | | | | | | Add an explicit References field to message info. This is useful for storing information needed for threading without storing all of the header values, keeping system RAM usage lower. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* envelope: add InReplyTo fieldTim Culverhouse2022-11-093-5/+18
| | | | | | | | | | A standard IMAP envelope response includes the In-Reply-To header field. Add this field to the aerc model of Envelope. Update envelope parser to set this value. Update imap worker to set this value. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: add support for ORDEREDSUBJECT threading algorithmjp392022-11-092-5/+11
| | | | | | | | | | | | The imap worker incorrectly tries to use the REFERENCES threading algorithm by default although some servers only support the ORDEREDSUBJECT threading algorithm. Use whichever threading algorithm is advertised as supported by the server, buf prefer REFERENCES if available. Signed-off-by: jp39 <jp39@gmx.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* 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>
* notmuch: correct a typo in error messageinwit2022-11-091-1/+1
| | | | | Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: allow whitespace before '=' in query-mapinwit2022-11-091-2/+2
| | | | | | | | | When reading the query-map file, any white spaces before the '=' were read as part of the query name. Trim any leading and trailing white space from the query name. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* composer: add message previewKoni Marti2022-11-095-8/+25
| | | | | | | | | | Add message preview to the composer. Add preview option to the review window. Open the message in a message viewer before sending to check the headers and attachments. Implements: https://todo.sr.ht/~rjarry/aerc/86 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lib: prepare attachments for multiple readsKoni Marti2022-11-094-22/+57
| | | | | | | | | | | Prepare attachments for multiple reads. The data for lib.PartAttachment is stored as an io.Reader which can only be read once. This will cause an issue when we want to call composer.WriteMessage multiple times, i.e. for a message preview. We fix this by keeping a copy of the data and create a new reader everytime the attachment is read. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* viewer: open rfc822 attachmentsKoni Marti2022-11-093-10/+29
| | | | | | | | | | Open message/rfc822 attachments from the message viewer when no filter is defined for this mimetype. When the rfc822 part is selected, call the eml command to open the attachment in a new message viewer. Suggested-by: Jens Grassel <jens@wegtam.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* commands/eml: open and view eml filesKoni Marti2022-11-092-0/+66
| | | | | | | | | Open and view eml data from a file. Call the eml command and use the completion feature to select an eml file from disk. The eml data will be opened in the message viewer. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* lib: implement an eml message viewKoni Marti2022-11-094-4/+116
| | | | | | | | | Implement a MessageView representation for eml data that are not stored in a message store. With this, we can display any rfc822 message data in the message viewer. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: invalidate ui when queuing redrawTim Culverhouse2022-11-064-5/+3
| | | | | | | | | | | | | | | The QueueRedraw function should always be preceeded by a call to ui.Invalidate in order to make a redraw a occur. In one instance, this was not done and it was possible for the UI to not redraw itself (when a terminal closes, a UI redraw request is made but it is possible for the UI to not be invalidated as a result of the close). Move the call to Invalidate into the QueueRedraw function to ensure that every QueueRedraw call will redraw the screen. Fixes: https://todo.sr.ht/~rjarry/aerc/98 Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* split: close current split after replacing with newTim Culverhouse2022-11-061-3/+3
| | | | | | | | | | Close the current split view after replacing it with a new view. Previously we closed it before replacing it with the new split view which could create a race condition when attempting the replace. Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msglist: style search resultsTim Culverhouse2022-11-066-0/+21
| | | | | | | | Add option to style search results in the message list. Set default style for results. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* maildir: keep less data in memory for sortingTim Culverhouse2022-11-063-1/+67
| | | | | | | | | | | | | | | | 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>
* msgviewer: warn user when pager is not in PATHTim Culverhouse2022-11-061-1/+11
| | | | | | | | | Warn user when configured pager is not in PATH. Attempt fallbacks, and throw error if none of the fallbacks are in PATH. Fixes: https://todo.sr.ht/~rjarry/aerc/94 Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* msgstore: use default sort when applying ClearTim Culverhouse2022-11-061-1/+3
| | | | | | | | | | The :clear command clears any sorting, filtering, or marking of messages within the message store. Respect the user's default sort order by storing this in the store and re-applying the default sort when using clear. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: warn user when editor is not in PATHTim Culverhouse2022-11-062-5/+30
| | | | | | | | | Warn user when configured editor is not in path. Attempt fallbacks, and throw error if none of the fallbacks are in PATH. Fixes: https://todo.sr.ht/~rjarry/aerc/94 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>
* status: add warning style and methodsTim Culverhouse2022-11-065-0/+18
| | | | | | | | Add a warning style to default statusline. Add methods to status, aerc, and account to push a warning message. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threads: fix ordered insert of sibling nodesKoni Marti2022-11-062-4/+139
| | | | | | | | | | | | Fix the ordered insert for multiple siblings when using client-side threading. When there are more than two siblings already in the list, the third element will not be inserted in proper order. Add tests and better documention for the insert node functions. Fixes: 5eac8d60 ("thread: add method to append new node") Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* threadbuilder: better scaling for thread insertionKoni Marti2022-11-061-4/+10
| | | | | | | | | | Improve thread builder's performance scaling by inserting a new top-level thread at the beginning of the linked list which is an O(1) operation. The order of the top-level threads does not matter here since they will be sorted later anyways. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* threadbuilder: sort siblings by sort criteriaKoni Marti2022-11-067-12/+63
| | | | | | | | | | | | | | Sort the client-side thread siblings according to the sort criteria. Activate this option by setting "sort-thread-siblings" to true in the ui section of aerc.conf. "sort-thread-siblings" is false by default and the siblings will be sorted based on their uid number. Note that this options will only work with client-side threading and when the backend supports sorting. Also, it comes with a slight performance penalty. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* threadbuilder: streamline thread builder internalsKoni Marti2022-11-061-43/+30
| | | | | | | | | | | | Streamline the internals of the client-side thread builder. Handle the jwz dummy threads explicitly and let jwz deal with message-id collisions. This should make the client-side threading more stable overall. Duplicated message-ids will also be properly displayed now. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* auto-completion: add option to require a min number of charsRobin Jarry2022-11-066-8/+52
| | | | | | | | | | When doing address completion via commands that take a while to run, having the completion trigger even with a single character can be non-optimal. Add an option to allow requiring a minimum number of characters to actually run the completion command. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* address-book-cmd: be more lenient with errorsRobin Jarry2022-11-031-6/+14
| | | | | | | | | | | | | | Instead of failing completely when address-book-cmd returns an invalid line, ignore the line and report a warning in the logs. Do not wait for 100 "valid" addresses before bailing out as the command could only output garbage in large quantities. The issue of the command not printing any new line characters still exists. We could address this but I think it would be overkill. Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* address-book-cmd: ignore completion above 100 itemsRobin Jarry2022-11-021-0/+17
| | | | | | | | | | | | | | | | | Avoid aerc from consuming all memory on the system if an address book command returns 12 million addresses. Read at most the first 100 lines and kill the command if it has not finished. Display a warning in the logs for good measure. The command is now assigned an different PGID (equal to its PID) to allow killing it *and* all of its children. When the address book command is a shell script that forks a process which never exits, it will avoid killing the shell process and leaving its children without parents. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
* msglist: display reversed thread orderingKoni Marti2022-10-272-56/+65
| | | | | | | | Reverse the ordering of the message threads. Implements: https://todo.sr.ht/~rjarry/aerc/54 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* threads: reverse thread orderingKoni Marti2022-10-277-13/+51
| | | | | | | | | | | Add reverse-thread-order option to the ui config to enable reverse display of the mesage threads. Default order is the the intial message is on the top with all the replies being displayed below. The reverse options will put the initial message at the bottom with the replies on top. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* store: implement the simplified index handlingKoni Marti2022-10-272-33/+36
| | | | | | | | | | Simplify the index handling for moving to the next or previous message. Same for moving to the next or previous search results. Moving of the index variable relies on the iterator package's StartIndex and EndIndex functions. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* iterator: add functionality to move indicesKoni Marti2022-10-272-0/+184
| | | | | | | | Extract the index acrobatics from the message store and move it to iterator package for re-use and to add unit tests. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* store: reverse message list order with iteratorsKoni Marti2022-10-278-52/+123
| | | | | | | | | | | | | | | | | Reverse the order of the messages in the message list. The complexity of reversing the order is abstracted away by the iterators. To reverse the message list, add the following to your aerc.conf: [ui] reverse-msglist-order=true Thanks to |cos| for sharing his initial implementation of reversing the order in the message list [0]. [0]: https://git.netizen.se/aerc/commit/?h=topic/asc_sort_imap Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* iterator: implement iterators over uid/thread dataKoni Marti2022-10-273-0/+255
| | | | | | | | | | | | Implement an iterator framework for uid and thread data. Iterators ensure that the underlying data is accessed in the right order and provide an abstraction of the index handling. Iterators should be used when the order of the uids/threads is important. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* notmuch: move new maildir files to cur upon opening a folderJulian Pidancet2022-10-271-1/+39
| | | | | | | | | | | | | | | | | | | | | By default "notmuch new" will index files in place and won't move new files from the new/ directory to cur/ because it assumes that is the job of the email client. During normal operation, once moved by the client, the "notmuch new" command will "fix" the database by detecting file renames. This workflow is a problem because we need to move the new/ files to cur/, otherwise the maildir lib will not work properly, but at the same time we cannot afford the notmuch database to be out of sync with the location of message files on disk, because we rely on it for listing folders, displaying emails, ect... This change uses a trick that request notmuch to synchronize message tags to maildir flags, that will effectively rename new files and cause them to be moved into the cur/ directory. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: add MsgIDFromFilename method to notmuch.DBJulian Pidancet2022-10-271-0/+16
| | | | | | | | | Add a method to retrieve the message key associated with a message file path, if indexed in the database. Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* notmuch: fix bad copy-paste in MsgModifyTags loggingJulian Pidancet2022-10-271-1/+1
| | | | | | | | | | Print "failed to remove tag" instead of "failed to add tag" when removing tag failed. Fixes: 5ca6022d007b ("lint: ensure errors are at least logged (errcheck)") Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com> Acked-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>