aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* imap: fix out-of-range panic for imap updatesKoni Marti2022-04-291-0/+14
| | | | | | | | | | Check slice bounds before using it for the message and expunge updates. Log the error but ignore the affected updates. Link: https://lists.sr.ht/~rjarry/aerc-devel/%3CCJEHBFFUI11T.1AYGOMVGZ87ZS%40rek2system%3E Reported-by: ReK2 <rek2@hispagatos.org> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: use account ui config where missingRobin Jarry2022-04-281-5/+5
| | | | | | | | | | | | The composer widget already has a reference to the AccountView object. Get the UI config from it directly. This completes commit 6edfbfa8ce37 ("aerc: use contextual ui styleset for tabs/compose"). Fixes: https://todo.sr.ht/~rjarry/aerc/3 Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Koni Marti <koni.marti@gmail.com>
* grid: don't draw at a negative offsetConnor Kuehl2022-04-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aerc panics when using macOS's default terminal emulator, Terminal.app, when closing all but aerc's tab: This error was also written to: /tmp/aerc-crash-20220427-194134.log panic: Attempted to create context with negative offset [recovered] panic: Attempted to create context with negative offset goroutine 1 [running]: git.sr.ht/~rjarry/aerc/logging.PanicHandler() /Users/ckuehl/src/aerc/logging/panic-logger.go:47 +0x58c panic({0x100d077a0, 0x14000032700}) /opt/homebrew/Cellar/go/1.18.1/libexec/src/runtime/panic.go:844 +0x258 git.sr.ht/~rjarry/aerc/lib/ui.(*Context).Subcontext(0x1400013e420?, 0x14000202360?, 0x140000ffc48?, 0x1009a10e4?, 0x100da9440?) /Users/ckuehl/src/aerc/lib/ui/context.go:47 +0x160 git.sr.ht/~rjarry/aerc/lib/ui.(*Grid).Draw(0x1400013e420, 0x14000202360) /Users/ckuehl/src/aerc/lib/ui/grid.go:143 +0x2bc git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Draw(0x1400013e4d0, 0x14000202360) /Users/ckuehl/src/aerc/widgets/aerc.go:178 +0x30 git.sr.ht/~rjarry/aerc/lib/ui.(*UI).Tick(0x1400022bcc0) /Users/ckuehl/src/aerc/lib/ui/ui.go:116 +0x248 main.main() /Users/ckuehl/src/aerc/aerc.go:226 +0x9e8 I'm not entirely sure what the interactions are between the terminal emulator, aerc's grid, and the space that moves around when the tab bar disappears because there are no more tabs, but this fixes the issue 100% of the time and I haven't noticed any issues. Signed-off-by: Connor Kuehl <cipkuehl@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* imap: avoid crash when replying to unread messageRobin Jarry2022-04-281-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running `:reply -q` on an unread message, aerc crashes after opening the editor: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x5d1019] goroutine 63 [running]: bufio.(*Reader).fill(0xc000086ef8) /usr/lib/golang/src/bufio/bufio.go:106 +0xd9 bufio.(*Reader).Peek(0xc00020bef8, 0x1) /usr/lib/golang/src/bufio/bufio.go:144 +0x5d github.com/emersion/go-message/textproto.ReadHeader(0xc00004a700?) emersion/go-message@v0.15.0/textproto/header.go:525 +0x5f git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessageBodyPart.func1(0xc00056e280) worker/imap/fetch.go:99 +0x1ab git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessages.func1() worker/imap/fetch.go:178 +0xd7 created by git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessages worker/imap/fetch.go:172 +0x12b This happens because the flags are updated in the callback that receives the message itself. It causes the flag update to arrive in the same channel/request. Ignore the messages that have an empty body (i.e. only containing flag updates). This is inherently racy but there seems no way to get rid of these extra messages. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Connor Kuehl <cipkuehl@gmail.com>
* feat: add gpg integrationTim Culverhouse2022-04-2718-30/+1493
| | | | | | | | | | | | | | | | | | | This commit adds gpg system integration. This is done through two new packages: gpgbin, which handles the system calls and parsing; and gpg which is mostly a copy of emersion/go-pgpmail with modifications to interface with package gpgbin. gpg includes tests for many cases, and by it's nature also tests package gpgbin. I separated these in case an external dependency is ever used for the gpg sys-calls/parsing (IE we mirror how go-pgpmail+openpgp currently are dependencies) Two new config options are introduced: * pgp-provider. If it is not explicitly set to "gpg", aerc will default to it's internal pgp provider * pgp-key-id: (Optionally) specify a key by short or long keyId Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* refactor: refactor pgp implementationTim Culverhouse2022-04-2715-193/+356
| | | | | | | | | This commit refactors the internal PGP implementation to make way for GPG integration. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* style: add style config options for dirlist_unread and dirlist_recentTim Culverhouse2022-04-274-10/+46
| | | | | | | | Adds two style options: dirlist_unread and dirlist_recent. These options apply in layers, in the same way as msglist_* styles do. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* pgp: ensure CRLF line endings in pgpmail readerKoni Marti2022-04-252-1/+12
| | | | | | | | | | | | | | | | | | Ensure CRLF line endings in the pgpmail reader. Fix the pgp signature verification for maildir and notmuch. These backends do not return the full message body with CRLF line endings. But the accepted OpenPGP convention is for signed data to end with a <CR><LF> sequence (see RFC3156). If this is not the case the signed and transmitted data are considered not the same and thus signature verification fails. Link: https://datatracker.ietf.org/doc/html/rfc3156 Reported-by: Tim Culverhouse <tim@timculverhouse.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
* msgviewer: show available bindings when filter not configuredkt programs2022-04-251-27/+59
| | | | | | | | | | Show what command can be used to achieve the described effect so users can add it as a binding. Fixes: https://todo.sr.ht/~rjarry/aerc/40 Signed-off-by: kt programs <ktprograms@gmail.com> Tested-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: add unsafe-accounts-conf optionVictor Freire2022-04-253-6/+32
| | | | | | | | | | | This adds the option "unsafe-accounts-conf" under the section [general] of aerc.conf. This allows an user to specify if the accounts.conf file must be restrict to be read by the file owner (0600). By default it is set to "false". Signed-off-by: Victor Freire <victor@freire.dev.br> Acked-by: Robin Jarry <robin@jarry.cc>
* binds: fix incorrect key names for c-] and c-[Ivan Oleynikov2022-04-251-2/+2
| | | | | | | The left and right square brackets are inverted. Fix that. Signed-off-by: Ivan Oleynikov <ivan.oleynikov95@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* filter: clear filter when called with no argsKoni Marti2022-04-251-0/+3
| | | | | | | | Clear filter when called with no arguments. Fixes: https://todo.sr.ht/~rjarry/aerc/35 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* statusline: refactor to make it more customizableKoni Marti2022-04-258-93/+407
| | | | | | | | | | | | | | | | | Refactor statusline by clearly separating the rendering part from the text display. Use printf-like format string for statusline customization. Document printf-like format string to customize the statusline. Allow to completely mute the statusline (except for push notifications) with a format specifier. Provide a display mode with unicode icons for the status elements. Implements: https://todo.sr.ht/~rjarry/aerc/34 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: clarify threading-enabled optionKenneth Flak2022-04-192-1/+7
| | | | | | | This is only supported with notmuch and specific imap servers. Signed-off-by: Kenneth Flak <kennethflak@protonmail.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
* store: keep current message selectedKoni Marti2022-04-174-2/+55
| | | | | | | | | | | | Keep current message selected when clearing or changing filters and when toggling threads. Add -s flag to the clear command to also clear the selected message and set cursor to the top of the message list. Implements: https://todo.sr.ht/~rjarry/aerc/36 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* status: use contextual ui styleset for statuslineKoni Marti2022-04-171-7/+9
| | | | | | | Use contextual ui styleset for statusline widget. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* aerc: use contextual ui styleset for tabs/composeKoni Marti2022-04-172-8/+24
| | | | | | | | | Use contextual ui styleset for tabs and compose widgets. If no account is selected, use default styleset as fallback. Fixes: https://todo.sr.ht/~rjarry/aerc/3 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* Add html "unsafe" filter to work also without danteJens Grassel2022-04-172-0/+17
| | | | | | | | If socksify (from dante) is not installed then the filter uses w3m without it to render an html message part. Signed-off-by: Jens Grassel <jens@wegtam.com> Acked-by: Robin Jarry <robin@jarry.cc>
* binds: allow to bind a command to < and >Koni Marti2022-04-171-0/+8
| | | | | | | | | | | | | | | Allow to bind to < and > by using \< and \> in binds.conf. Ensure that the single \ can still be properly used to bind to other commands. For example, the following binds would work now: \< = :prev-tab<Enter> \> = :next-tab<Enter> \ = :filter<space> Fixes: https://todo.sr.ht/~rjarry/aerc/37 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Sebastian LaVine <mail@smlavine.com> Acked-by: Robin Jarry <robin@jarry.cc>
* review: show command that will be executed by bindingkt programs2022-04-141-4/+2
| | | | | | | | Also show commands that don't have a binding. This allows users to see what's available to bind. Signed-off-by: kt programs <ktprograms@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* main: remove unnecessary pointer dereferenceConnor Kuehl2022-04-141-2/+2
| | | | | | | Calling a method on a pointer will dereference it automatically. Signed-off-by: Connor Kuehl <cipkuehl@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* binds: add binding for :open by default in viewerkt programs2022-04-141-1/+2
| | | | | | | | Also move binding for :delete such that the :open, :save, :pipe command bindings are grouped together. Signed-off-by: kt programs <ktprograms@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* forward: allow ':forward -A' with no addressTim Culverhouse2022-04-141-6/+9
| | | | | | | | Allow using the command ':forward -A' without specifying an email address inline. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
* config: don't swallow error in checkConfigPermsConnor Kuehl2022-04-141-1/+5
| | | | | | | | | | os.Stat might return other errors aside from one stating that the file does not exist. If it does, propagate the error down. As before, if the file does not exist, just do nothing. Signed-off-by: Connor Kuehl <cipkuehl@gmail.com> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* Initialization fix for dynamic foldersAivars Vaivods2022-04-141-0/+9
| | | | | | | | | | | | | | | | | | | There is an issue with backends, that provide dynamic folders, namely when opening folder, that isn't defined in config file, you get empty folder. To actually get messages listed, you need to open that folder twice. At first attempt only DirectoryInfo is fetched and new MessageStore created. Second attempt populates previously created MessageStore with list of messages. For pre-configured folders, DirectoryInfos are fetched upon connection to backend and, when folder is opened, MessageStore is updated with list of messages. Fixes: https://todo.sr.ht/~rjarry/aerc/30 Signed-off-by: Aivars Vaivods <aivars@vaivods.lv> Acked-by: Robin Jarry <robin@jarry.cc>
* mk: do not depend on cmp being availableRobin Jarry2022-04-141-3/+1
| | | | | | | cmp is part of gnu diffutils which may not be available. Use grep which is more widespread. Signed-off-by: Robin Jarry <robin@jarry.cc>
* builds: add gnupg in preparation of gpg integrationRobin Jarry2022-04-145-1/+5
| | | | | | This is required for future gpg unit tests to run. Signed-off-by: Robin Jarry <robin@jarry.cc>
* builds: test with notmuchRobin Jarry2022-04-144-1/+8
| | | | | | This is never tested. Let's check that it compiles at least. Signed-off-by: Robin Jarry <robin@jarry.cc>
* builds: reformat yamlRobin Jarry2022-04-144-50/+53
| | | | | | Use two spaces for indentation consistently. Signed-off-by: Robin Jarry <robin@jarry.cc>
* imap: fix no-envelope-for-message errorKoni Marti2022-04-111-1/+3
| | | | | | | | | | | | | | | | | | | | | Fix the "no envelope available for this message" error that can occur when using the same imap mailbox in another mailclient (e.g. through a webmail interface) at the same time. Complements the fixes in commit 7fe7fe4 ("ui: fix panic in header formatter") and commit 074b0a1 ("view,list: fix crash when viewing incomplete imap messages"). The error is caused when a message attribute update is received by the message store before the message list had a chance to fetch the proper header first. In this case, an (incomplete) message info is stored in the message store and the message list will never fetch the correct header. To prevent this, add only messages to the store with a non-nil envelope but make sure that message attribute updates are properly merged. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* stylesets: allow specifying color by numberTobias Wölfel2022-04-072-2/+18
| | | | | | | | | Make it possible to specify the color in the style sets by number in addition to the color name. This allows using colors defined by the terminal. Signed-off-by: Tobias Wölfel <tobias.woelfel@mailbox.org> Acked-by: Robin Jarry <robin@jarry.cc>
* fix: out-of-bounds error in command headerMoritz Poldrack2022-04-061-0/+6
| | | | | | | | This commit fixes an out-of-bound error that happened while parsing commands. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* header: remove trailing colon in header fieldMoritz Poldrack2022-04-061-0/+2
| | | | | | | | With this commit trailing colons in the :header command's field are removed to prevent double-colon-headers from being sent. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* ui: fix panic in header formatterMoritz Poldrack2022-04-061-0/+4
| | | | | | Reported-by: noex Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* compose: parse headers correctly from -HEvan Gates2022-04-061-2/+15
| | | | | | | | | | | | By using :compose -H <header> a user should be able to add arbitrary headers to an email. The existing implementation from 5b523880b4b4cd2abd9457b4b09c384af33be14b added the headers as lines to the beginning of the body. These lines were not interpreted as headers anywhere and ended up as plain text in the body of the email. Fix the code to parse and add the headers correctly. Signed-off-by: Evan Gates <evan.gates@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* mk: rename ambiguous LDFLAGS variableRobin Jarry2022-04-061-4/+7
| | | | | | | | | | | | | | | | | | The LDFLAGS environment variable is usually indented for C the linker flags which are not compatible with go -ldflags. Use a more explicit GO_LDFLAGS variable instead. Allow adding extra flags without overriding the default ones by specifying GO_EXTRA_LDFLAGS. This may break the build on some distros that rely on setting LDFLAGS to change the default shareDir or version. They will have to switch to GO_EXTRA_LDFLAGS. Link: https://salsa.debian.org/go-team/packages/aerc/-/commit/e9ed90beae9f Link: https://src.fedoraproject.org/rpms/aerc/blob/f36/f/aerc.spec#_86 Fixes: e7e22aba60ce ("mk: rebuild if goflags or ldflags have changed") Signed-off-by: Robin Jarry <robin@jarry.cc>
* save: fix path completionRobin Jarry2022-03-311-0/+9
| | | | | | | | Ignore option flags and prepend default-save-path if the current path is not absolute. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
* statusline: indicate when sorting is in progressKoni Marti2022-03-253-2/+16
| | | | | | | Indicate when sorting is in progress in the statusline. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* store: sort messages even when a filter is appliedKoni Marti2022-03-251-0/+1
| | | | | | | | | | Sort the message list even when a filter is applied according to the sort criteria given by the sort command. Currently, the sort command has no effect when a filter is in use. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* sort: keep sort criteria applied to folderKoni Marti2022-03-253-8/+16
| | | | | | | | | | | | | | | Keep the sort criteria applied to the selected folder until the default sort order should be restored. Call the sort command without arguments to restore the default sort order. The current behavior is that the default sort order is restored as soon as the folder reloads. This happens often and then the results of the sort command are lost. This makes the sort command not very user-friendly. Instead, we should keep the sort criteria applied until the user explicitly wants to restore the default sort order again. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* statusline: improve status line updatingKoni Marti2022-03-252-1/+10
| | | | | | | | | | | | Update statusline only for the selected account (to prevent other updates from different accounts to interfere). Update status when jumping/selecting/closing tabs. Fixes cosmetic regressions introduced by commit feecc09b73e2 ("statusline: make statusline folder-specific"). Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* completion: install panic handler in completion callbackRobin Jarry2022-03-251-0/+2
| | | | | | | | | This callback is actually invoked in a goroutine by time.AfterFunc. The panic handler must be explicitly installed. Link: https://github.com/golang/go/blob/go1.18/src/time/sleep.go#L160-L173 Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
* show-ics-details.py: fix error with python < 3.9Jens Grassel2022-03-241-16/+16
| | | | | | | | Change the pattern matching into a if/elif construct because pattern matching is not supported on python < 3.9. Signed-off-by: Jens Grassel <jens@wegtam.com> Acked-by: Robin Jarry <robin@jarry.cc>
* save: add -a option to save all attachmentsRobin Jarry2022-03-243-18/+69
| | | | | | | | | | Allow saving all message parts that have the content disposition "attachment" header to a folder. Suggested-by: Ondřej Synáček <ondrej@synacek.org> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* logging: fix race condition in startupMoritz Poldrack2022-03-244-7/+14
| | | | | | | | | If a panic occurs in one of the workers, it can happen after the UI was initialised, but before the cleanup function has been registered. With this the start of the worker loops is deferred until the cleanup routine was registered. Signed-off-by: Moritz Poldrack <git@moritz.sh>
* readme: add ~rjarry/aerc-discuss@lists.sr.ht in resourcesRobin Jarry2022-03-241-2/+5
| | | | | | | Add a reference to a new end-user discussion list. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
* readme: add links to documentationRobin Jarry2022-03-241-3/+20
| | | | | | | Let's make it easier for new users to find information. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Moritz Poldrack <moritz@poldrack.dev>
* threading: fix msg-id order in references headerKoni Marti2022-03-231-5/+17
| | | | | | | | | | | Fix order in the references header when an in-reply-to msg-id is erroneously added at the beginning instead of at the end. Add description to the function that cleans up the reference headers for threading. Reported-by: Evan Gates <evan.gates@gmail.com> Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
* Add filter script for ics files.Jens Grassel2022-03-232-0/+90
| | | | | | | | This is a python script for python 3 using the vobject library to show details about an ics file (text/calendar attachment). Signed-off-by: Jens Grassel <jens@wegtam.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
* logging: added a log on panicMoritz Poldrack2022-03-2327-23/+161
| | | | | | | | | | | | | Since panics still regularly "destroy" the terminal, it is hard to get a stack trace for panics you do not anticipate. This commit adds a panic handler that automatically creates a logfile inside the current working directory. It has to be added to every goroutine that is started and will repair the terminal on a panic. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>