aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-06-07wipjmapRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-06jmapRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-04mbox: use named loggerRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-04notmuch: use named loggerRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-04maildir: use named loggerRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-04imap: use named loggerRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-04worker: use named loggerRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-04logger: add support for named loggersRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-06-01config: fix multiple dynamic stylesTim Culverhouse
When a user sets multiple dynamic styles, only the first one is applied. The parsing function is modifying the matching pattern prior to saving it to the style. When a second occurrence of the same dynamic style is seen, the patterns don't match because we compare against the raw user input instead of the modified pattern value. Store the raw user input as the pattern instead of our modified regex. Fixes: 2f46f64b0b0b ("styleset: allow dynamic msglist styling") Reported-by: Drew Devault <sir@cmpwn.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Drew Devault <sir@cmpwn.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-06-01compose: quit composing when editor returns errorMoritz Poldrack
When the editor crashes, or the user forces it to exit with an error code, it is safe to assume that they can't (if the command failed) or don't want to (if :cq'd) continue composing a meaningful message. Suggested-by: tristan957 Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-06-01contrib: add carddav-query scriptRobin Jarry
Add a standalone python script to allow querying contacts from a CardDAV compatible server. The script works with python 3.6+ and has no external dependencies. Link: https://sabre.io/dav/building-a-carddav-client/ Link: https://www.rfc-editor.org/rfc/rfc6352 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
2023-05-30contributing: cleanupRobin Jarry
Remove outdated information. Add wiki specific instructions. Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-05-30doc: fix invalid markupRobin Jarry
Extraneous underscore slipped in. Fixes: 3d99fae3d224 ("term: add config options for TERM and osc8") Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-05-28doc: mention regex for the bindings definitioninwit
Document the possibility of using regex when defining bindings for specific accounts or folders. Signed-off-by: inwit <inwit@sindominio.net> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2023-05-28lib: don't set seen flag upon errorKoni Marti
Don't set the Seen flag when an error occurs during opening the message. Fixes: https://todo.sr.ht/~rjarry/aerc/125 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-28dirstore: list the folders in arrival orderKoni Marti
List the folders in arrival order when dirstore.List() is called instead of returning it in an arbitrary order. If enable-folders-sort=false and dirlist-tree=false, the directory list will arbitrarly reshuffle when changing directories because the dirlist.dirs are generated from keys in a map in the dirstore. Fixes: https://todo.sr.ht/~rjarry/aerc/178 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-21statusline: fix typo in deprecation warningVlad-Stefan Harbuz
This was a bad copy paste from config/ui.go. Fixes: d2e74cdb91e1 ("statusline: add column based render format") Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-20maildirpp: fix path separatorKoni Marti
Fix path separator for the maildir++ backend. Maildir++ already substitutes '.' for os.PathSeparator. Returning '.' will thus break the directory tree and the other logic for this backend. Fixes: 2040fc18 ("imap: use delimiter from server") Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-20ui: fix deadlocks in message channelRobin Jarry
There are several ways the ui message channel can fill up leading to deadlocks. 1) Invalidate() changes the value of uiState to DIRTY. The following call sequence: QueueRedraw() Invalidate() QueueRedraw() Leads to multiple nil messages being queued in the message channel whereas one could assume that the second QueueRedraw() would do nothing. This is caused by the tri-state nature of uiState. 2) We use the same channel to convey state change, keyboard events and redraw requests. Since a keyboard event almost always triggers a redraw, we end up trying to append a redraw message in the same goroutine that reads from the channel. This triggers a deadlock when there are more than 50 pending messages. Solve the issue by using multiple channels, one per type of message that needs to be sent to the main ui thread. Remove QueueRedraw() and merge its functionality in Invalidate(). Only use a DIRTY/CLEAN state to determine if something needs to be queued in the redraw channel. Use a channel for quitting instead of an atomic. Restructure some code functions to have a cleaner API. Use a for loop in the main thread and select from all channels. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com> Tested-by: Maarten van Gompel <proycon@anaproy.nl>
2023-05-20templates: add boolean flagsRobin Jarry
Allow accessing email flags via boolean properties instead of having to rely on obscure regular expressions on (.Flags | join ""). With this patch, it is now possible to do this: [ui] index-columns = star:1,name<15%,reply:1,subject,size>=,date>= column-star = {{if .IsFlagged}}β˜…{{end}} column-name = {{if eq .Role "sent"}}{{.To | names | join ", "}}{{else}}{{.From | names | join ", "}}{{end}} column-reply = {{if .IsReplied}}ο„’{{end}} column-subject = {{.ThreadPrefix}}{{.Subject}} column-size = {{if .HasAttachment}}πŸ“Ž {{end}}{{humanReadable .Size}} column-date = {{.DateAutoFormat .Date.Local}} Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com>
2023-05-16templates: use template interface consistentlyKoni Marti
Use the template interface consistently. Before, we have exported the state.TemplateData struct and used it in most places instead of the models.TemplateData interface. This lead to some inconsistencies, i.e. Role() has been defined on the exported struct but not on the interface. Unexport the state.TemplateData struct, add a DataSetter interface to set the data needed for the template data and call the Data() method which returns a models.TemplateData interface when the template data is needed. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2023-05-16headers: enable partial header fetchingTim Culverhouse
Enable partial header fetching by creating config values for headers to specifically include, or specifically exclude. The References field will always be fetched, regardless of the include list. Envelope data is always fetched, but is not shown with :toggle-headers, since it isn't in the RFC822 struct unless explicitly included in the list. Partial headers can break the cache on changes. Update the cache tag key to include the state of the partially-fetched headers. Partial header fetching can have a significant performance increase for IMAP, and for all backends a resource improvement. Some data to support this is below. Gathered by opening aerc, selecting a mailbox with approximately 800 messages and scrolling to the end. Received measured with nethogs, RAM from btop Received | RAM ------------------------------------- All Headers | 9,656 kb | 103 MB Minimum Headers | 896 kb | 36 MB Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16dirtree: fixup to apply correct patchset versionRobin Jarry
I had applied v2 instead of v4... It is time to automate these things a bit better. Fixes: 6e038c7fd510 ("dirtree: modify drawing of the dirtree") Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-05-16imap: handle the NonExistent attributeKoni Marti
Treat the "\NonExistent" attribute similar to the "\NoSelect" one. Only list folders without the "\NonExistent" or "\NoSelect" attribute. According to RFC 9501, section 7.3.1, the "\NonExistent" attribute implies "\NoSelect". When using the LIST-STATUS extension, some servers return a "\NonExistent" flag instead of the "\NoSelect" one. We only check for the "\NoSelect" attribute, and hence, a "\NonExistent" folder will appear in the directory list and raise an error when being selected. This occurs, e.g., for gmail accounts with the "[Gmail]" folder. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16dirtree: clear msglist for virtual nodesKoni Marti
Clear the message list when a virtual node is selected. Add a VirtualNodeCallback to the Dirlist interface. Reported-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16config: update default pagerMoritz Poldrack
Since aercs embedded terminal now behaves correctly, a messages contents are at the bottom of the pager by default, this has already sparked confusion as this is uncommon and not matching previous behaviour. Thanks: Stacy Harper <contact@stacyharper.net> Suggested-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16mkdir: add completionMoritz Poldrack
In order to combat potential issues of not knowing ones servers delimiter when creating directories, the delimiter is automatically appended to all suggested matches. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16archive: respect delimiterMoritz Poldrack
Since we now have support for using a server's custom delimiter, it's only right to also make use of this circumstance in the :archive command. Use the provided delimiter to join the path elements in the :archive command. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16imap: use delimiter from serverMoritz Poldrack
To accommodate servers that use a delimiter other than "/" ("." being a common alternative), the delimiter is fetched from the server when connecting. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16compose: warn before sending with empty subjectJason Cox
Ask user whether they want to abort before sending if the subject header is empty and they have enabled the warn-empty-subject config option. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2023-05-16colorize: style chunk function nameJason Cox
It's nice to use a different style for the chunk's function name to make it clear that the name is not necessarily adjacent to the chunk's actual lines. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16search/filter: update completionKoni Marti
Update the completion system by implementing the OptionsProvider and OptionComleter interfaces. The command flags that expect arguments can be completed now: -x,-X with the available flags, -t,-f,-c with the address book (after more then 3 characters), -d with a selected suggestion for useful dates. Examples: :filter -<Tab> lists the available option flags :filter -t org<Tab> fills the completion menu with address from your address-book-cmd matching "org" (same with -f and -c) :filter -x <Tab> lists the available flags (same with -X) :filter -d <Tab> lists a few convenient date terms Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16save: update completionKoni Marti
Use the updated completion and avoid removing flag when completing paths. Fixes: https://todo.sr.ht/~rjarry/aerc/110 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16recover: update completionKoni Marti
Update the completion system by implementing the OptionsProvider interface. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16textinput: align completion popoverKoni Marti
Align the completion popover with the actual completion location on the textinput line. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16textinput: improve stemmingKoni Marti
Fix cursor index after stemming and reset it to the position where the completion should occur. Only stem to add more information and not remove any user input. Stemming is activated on the textinput line when the user presses the Tab key. The idea of stemming is to adjust the textinput line to the common ground (="the stem") of the completions options. When the stemmed input line is set, however, the cursor will be moved to the end of the line if there is a text part on the right side of the cursor where the completion should occur. Another Tab press will activate the onStem function again, which then removes the right part of the text input leading to the loss of the user input. This can be prevented by moving the cursor to the place of the completion after stemming. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16commands: execute commands with templatesKoni Marti
Execute template code before running a command. With this, we can use templates in our keybinds like: [messages] E = :'{{if match (.Flags|join "") "O"}}envelope{{else}}view{{end}}'<Enter> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16commands: expand and complete template codeKoni Marti
Expand and complete template code. The exline does understand template code and can evaluate it. With this patch, the completion systems supports writing the templates by showing the available template data fields and template functions. Pressing <Tab> after }} will show the evaluated template in the completion menu. Complex template code, such as if-else statements work as well. Examples: :filter -f {{<Tab> will show the possible template data fields and functions :filter -f {{index (.To|email) 0}}<Tab> will show the value of the template expression in the completion list Pressing <Tab> twice after a completed template expression will substitute the expression with its value. :{{if match .Folder "INBOX"}}check-mail{{else}}cf INBOX{{end}} Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16commands: add OptionsProvider and OptionCompleterKoni Marti
Improve command completion by supporting option flags and option arguments completion. Option completion is activated when the command implements the OptionsProvider interface. Implementing the OptionCompleter allows the completion of individual option arguments. The completion interfaces harmonizes the completion behavior in aerc, makes the completion code clearer and simplifies the completion functionality. With this patch, the Complete method on commands will only have to deal with the actual completion, i.e. paths, folders, etc and not worry about options. To remove all options and its mandatory arguments from args, use commands.Operands(). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
2023-05-16maildir: fix sorting by sizeKoni Marti
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>
2023-05-16dirtree: modify drawing of the dirtreeTim Culverhouse
Update the dirtree drawing structure to be a bit more compact. The dirtree is drawn with one column left for a flag, which indicates if a parent is collapsed or expanded. Only draw the "flag" when the parent is collapsed. Change the flag to a '+' character to match common UI patterns of expanding lists having a '+' box. Don't draw the '>' character in the dirtree. This character is nice in the threaded message view, but clutters up the dirtree. I know this is a matter of preference, but this approach is similar to most other UI tree view and gives the dirtree an extra column of space. The original dirtree looks like this: β”ŒInbox β”œβ”€>Sub └─>Sub And collapsed: -Inbox This patch changes it to: Inbox β”œβ”€Sub └─Sub And collapsed: +Inbox Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2023-05-11Release version 0.15.20.15.2Robin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-05-11changelog: update before releaseRobin Jarry
Hopefully, this will be the last 0.15 bugfix release. Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-05-11maildir: fix FSWatcher handling of eventsTim Culverhouse
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>
2023-05-11msgstore: fix handling of deleted messagesTim Culverhouse
The msgstore trims the uid list when a message was deleted. It does so whether the message is in the message store or not. If the message was already deleted and a MessagesDeleted is received, the store will be trimmed regardless. This can cause spurious emails to be removed from the msgstore due to a race condition with the fs watcher / imap update channel. When a message is deleted, the UI will received two MessagesDeleted and in some cases trim the list, removing too many emails. Fix the handling of deleted messages so that the uid list is rebuilt of all messages except the deleted ones specifically. Reported-by: Drew Devault <sir@cmpwn.com> Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net>
2023-05-11filters: fix option parsing on arm cpusRobin Jarry
When running colorize or wrap on ARM, both programs exit immediately displaying their help message whatever the provided arguments. This is caused by an implicit downcast of the getopt return value. On most architectures, char is signed by default. On ARM, char is unsigned for performance reasons. Since the signed int return value of getopt is forced into a char, the results differ on ARM compared to x86. * Add -Wconversion -Warith-conversion to CFLAGS in CI builds to ensure catching such issues in the future. * Fix all -Wconversion -Warith-conversion reported issues. * Wide char functions need to deal with wint_t and wchar_t and it is guaranteed that a wchar_t can always fit into a wint_t. Add explicit casts to silence the reported warnings. Link: https://www.arm.linux.org.uk/docs/faqs/signedchar.php Link: https://lwn.net/Articles/911914/ Fixes: https://todo.sr.ht/~rjarry/aerc/164 Reported-by: Bence Ferdinandy <bence@ferdinandy.com> Suggested-by: Allen Sobot <chilledfrogs@disroot.org> Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
2023-04-28Release version 0.15.10.15.1Robin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-04-28changelog: update before releaseRobin Jarry
Signed-off-by: Robin Jarry <robin@jarry.cc>
2023-04-28maildir: fix handling of FSEventsTim Culverhouse
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>
2023-04-27term: upgrade tcell-termTim Culverhouse
Upgrade tcell-term, includes a bug fix when CUP is sent with only one param. Fixes: https://todo.sr.ht/~rjarry/aerc/170 Tested-by: ~staceeharper Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>