Commit Graph

1560 Commits

Author SHA1 Message Date
Fabio Manganiello 49bdace2f6 .seek(0) on the message before passing stdin to the markup process 2022-11-07 02:01:21 +01:00
Fabio Manganiello 5df1ebce35 Merged patch from https://lists.sr.ht/~rjarry/aerc-devel/patches/34390
Reference: https://lists.sr.ht/~rjarry/aerc-devel/patches/34390
2022-11-07 00:40:33 +01:00
Robin Jarry 14ceca3200 address-book-cmd: be more lenient with errors
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>
2022-11-03 10:15:12 +01:00
Robin Jarry 7565a96525 address-book-cmd: ignore completion above 100 items
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>
2022-11-02 13:18:19 +01:00
Koni Marti ae99f4c5bb msglist: display reversed thread ordering
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>
2022-10-27 22:47:30 +02:00
Koni Marti 006e10357b threads: reverse thread ordering
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>
2022-10-27 22:44:39 +02:00
Koni Marti 88afe7bb4a store: implement the simplified index handling
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>
2022-10-27 22:44:39 +02:00
Koni Marti 206665a2d9 iterator: add functionality to move indices
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>
2022-10-27 22:44:39 +02:00
Koni Marti c5face0b6f store: reverse message list order with iterators
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>
2022-10-27 22:44:39 +02:00
Koni Marti c83ffabf38 iterator: implement iterators over uid/thread data
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>
2022-10-27 22:44:39 +02:00
Julian Pidancet f20933f512 notmuch: move new maildir files to cur upon opening a folder
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>
2022-10-27 21:45:31 +02:00
Julian Pidancet 81440e79ad notmuch: add MsgIDFromFilename method to notmuch.DB
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>
2022-10-27 21:45:31 +02:00
Julian Pidancet 135439b83f notmuch: fix bad copy-paste in MsgModifyTags logging
Print "failed to remove tag" instead of "failed to add tag" when
removing tag failed.

Fixes: 5ca6022d00 ("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>
2022-10-27 21:45:31 +02:00
Julian Pidancet e2f864f2a9 notmuch: emit a DirectoryInfo message upon check-mail completion
Send a DirectoryInfo message when check-mail completes to re-fetch
directory content in case it changed.

Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-27 21:45:31 +02:00
Julian Pidancet c31a5fc33d notmuch: simplify DirectoryInfo emitting logic
Refactor the code emitting DirectoryInfo messages. Reduce function
call indirections by retiring gatherDirectoryInfo(), buildDirInfo() and
emitDirectoryInfo(), and replacing them with getDirectoryInfo()
(aligning the code with what is done in the maildir worker by the same
occasion).

Also merge queryFromName(), which no longer needs to be called from
different places, in handleOpenDirectory().

Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-27 21:45:31 +02:00
Julian Pidancet fbff8cf0ac notmuch: make maildir store path configurable
Add the "maildir-store" account configuration option to select the
maildir store to associate with the notmuch database.

This also allows the previous changes to be backward compatible since
not specifying this option will make the backend behave the same as if
there were no changes.

Fixes: https://todo.sr.ht/~rjarry/aerc/73
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-27 21:45:31 +02:00
Julian Pidancet c7bfe4e490 notmuch: add maildir support
By associating the notmuch database with a maildir store, we can add the
Copy/Move/Delete operations on messages to the notmuch backend.
This change assumes that the notmuch database location is also the root
of the maildir store.

In a previous change, we added the ability to dynamically add and remove
message files to the notmuch DB. This change uses this facility to
synchronize the database with the filesystem operations on maildir
files.

While it's still possible to use the query-map file to create virtual
folders from notmuch search queries, the sidebar is now loaded with the
folders found in the maildir store.

With notmuch, two identical but distinct message files can be indexed in
the database with the same key. This change takes extra care of only
deleting or removing message files from the maildir corresponding to the
folder that is currently selected (if any).

Implements: https://todo.sr.ht/~rjarry/aerc/88
Fixes: https://todo.sr.ht/~rjarry/aerc/73
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-27 21:45:24 +02:00
Julian Pidancet ea10b329dd maildir: replace ListFolder method with FolderMap
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>
2022-10-27 21:39:41 +02:00
Julian Pidancet f021bfd1c7 maildir: move common maildir code out of worker
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>
2022-10-27 21:39:41 +02:00
Julian Pidancet 19d16420de notmuch: add IndexFile and DeleteMessage methods to notmuch.DB
The new IndexFile and DeleteMessage allow dynamically inserting and
removing files to/from a notmuch database.

Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-27 21:39:41 +02:00
Julian Pidancet 748e60e6ca notmuch: add MsgFilenames method to notmuch.DB
Multiple files on the filesystem can be referenced under a single key in
the notmuch database. MsgFilenames() returns a list of filenames
associated with an index key.

Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-27 21:39:41 +02:00
Koni Marti 19e2750255 envelope: display message envelope info
Display entire message envelope in a user-friendly dialog popup with the
:envelope command. All header fields can be displayed with the -h flag.

Fixes: https://todo.sr.ht/~rjarry/aerc/85
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-26 00:19:49 +02:00
Koni Marti b860a64622 listbox: implement horizontal scrolling
Implement horizontal scrolling for selected lines that are longer than
dialog width. The following keys can be used:

Ctrl-a, Home	jump to beginning of line
Ctrl-e, End	jump to end of line
Left		move one character back
Right		move one character forward
Ctrl+b		move one word back
Ctrl+w		move one word forward

Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-26 00:19:48 +02:00
Julian Pidancet 8153f59188 maildir: fix maildir folder listing
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: 150aa0f498 ("maildir: hide invalid folders")
Signed-off-by: Julian Pidancet <julian.pidancet@oracle.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-25 23:30:56 +02:00
Robin Jarry a381630604 pipe: reorder patches based on email subjects
The Message-Id header cannot be relied upon as users can tweak it before
sending. The subject seems a more reliable basis to reorder patches.

Change the logic of sorting. Previously, all messages were required to
look like patches to be sorted. Now if at least one message looks like
a patch, all messages will be sorted by Subject before piping them.
Since `git am` ignores non-patch messages, it should allow piping series
of emails including reviews and comments without getting confusing
errors.

I have tested that this works on multiple series that appeared out of
order in my INBOX with the following command (after marking the
messages):

  :pipe -m sed -n 's/^Subject: //p'

Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
2022-10-25 22:24:31 +02:00
Robin Jarry a820e12d0f types: remove unused FullMessage.Info field
This field is always nil. Either we should initialize it to a proper
value or remove it. Since it is unused, remove it.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Moritz Poldrack <moritz@poldrack.dev>
2022-10-25 21:28:56 +02:00
Robin Jarry 9d71da175a colorize: make it compatible with BSD awk
Fix the following error seen on MacOS:

/usr/bin/awk: syntax error at source line 22 source file
                header_pattern = >>>  @ <<< /^[A-Z][[:alnum:]-]+:/

The @ character in front of regular expressions to pre-compile them
seems not in the POSIX specification. Replace them with regular strings
and call match() instead of the ~ operator.

Also, adjust the url_pattern expression for BSD awk which explicitly
states:

 The awk utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”)
 specification, except awk does not support {n,m} pattern matching.

Use [[:lower:]]+ instead of [a-z]{2,6}.

Tested with:

  GNU Awk 5.1.1
  awk version 20121220 (FreeBSD)

Link: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
Fixes: https://todo.sr.ht/~rjarry/aerc/96
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Koni Marti <koni.marti@gmail.com>
2022-10-23 20:51:02 +02:00
Robin Jarry 8e37d16a32 Release version 0.13.0
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-10-20 22:21:09 +02:00
Robin Jarry a1e81d2128 git-stats.sh: strip trailing white space
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-10-20 22:20:42 +02:00
Tim Culverhouse edd48c9981 split: clamp minimum split size to 1
The split command allows delta size changes, which triggers a condition
where the split can overflow into the dirlist. Clamp the minimum size of
a split or vsplit to "1" to prevent the view from overflowing, or
completely covering the message list. A split of 0 will still clear the
split.

Reported-by: Koni Marti <koni.marti@gmail.com>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-20 22:17:18 +02:00
Robin Jarry 0cc56781dc changelog: remove duplicate entry
Fixes: 56b9528d3a ("changelog: refine before release")
Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-10-20 14:53:45 +02:00
Robin Jarry 56b9528d3a changelog: refine before release
Add missing entries. Remove implementation details.

Signed-off-by: Robin Jarry <robin@jarry.cc>
2022-10-20 00:29:25 +02:00
Robin Jarry df1a0fff33 contrib: add git-stats.sh
git shortlog -sn is nice but it does not display the number of changed
files and the amount of changed lines.

  $ git shortlog -sn 0.12.0..
      46  Tim Culverhouse
      28  Robin Jarry
      14  Koni Marti
       9  Moritz Poldrack
       2  Ben Cohen
       2  Bence Ferdinandy
       2  Julian Pidancet
       2  inwit
       1  Jason Cox
       1  Jason Stewart
       1  John Gebbie
       1  Tobias Wölfel
       1  kt programs

Add a simple bash script that adds extra information:

  $ ./contrib/git-stats.sh 0.12.0..
  Author            Commits  Changed Files  Insertions  Deletions
  Tim Culverhouse        46            134        +973      -1090
  Robin Jarry            28             70        +671       -358
  Koni Marti             14             47        +437       -205
  Moritz Poldrack         9             18        +178        -44
  Ben Cohen               2              2         +16         -2
  Bence Ferdinandy        2              6        +104         +0
  Julian Pidancet         2              9        +149         -2
  inwit                   2              3         +11         -1
  Jason Cox               1              7        +106         -6
  Jason Stewart           1              1          +4         -2
  John Gebbie             1              3        +118         -1
  Tobias Wölfel           1              3          +3         -3
  kt programs             1              3         +37         -6

Use the script to generate the release tag and email.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-on-irc-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-20 00:29:16 +02:00
Robin Jarry 41c14b206c filters/colorize: various fixes
Diff chunks can occur in the middle of email conversations followed by
regular and/or quoted text. Handle that properly.

Change diff meta lines inside quotes to bold. Update the meta lines with
more combination for renamed, copied and deleted files.

Fix the diff_chunk invalid color code, only colorize the chunk
characters, not the whole line.

Remove redundant variable resets to 0.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-on-irc-by: Tim Culverhouse <tim@timculverhouse.com>
2022-10-20 00:28:58 +02:00
Koni Marti e055089d2f lib: fallback on raw msg when decoding fails
Avoid panic when part decoding fails:

  panic: quotedprintable: invalid unescaped byte 0x0c in body

User-friendlier fallback when a (decoding) error occurs while reading a
message part.

Link: https://lists.sr.ht/~rjarry/aerc-discuss/%3CCNJRVKUG8T68.3TVA2T10DTTBA%40guix-framework%3E
Reported-by: "(" <paren@disroot.org>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-19 23:52:44 +02:00
Tim Culverhouse 7585a54832 split: prevent panic when store is not set
Prevent panic when split is called but the msgstore is either not
initialized or has no UIDs. This condition could be triggered by calling
:split or :vsplit immediately at startup.

Use the same logic as the :view command, which could operate in a
similar manner.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-19 23:52:39 +02:00
Koni Marti c6463ba481 msgview: enable next/prev with unfetched headers
Fix message view behavior for unfetched headers. When scrolling "over"
the message list boundary, current behavior is to close the message
viewer tab. Now, the headers will be fetched so that we can scroll
through the messages uninterrupted.

Fixes: https://todo.sr.ht/~rjarry/aerc/90
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-19 21:51:16 +02:00
Tim Culverhouse bd8a4feecc split: prevent opening split when no messages are selected
The [v]split command panics when it is run with no message selected, or
when messages aren't loaded. Check for a valid selected message before
creating a split, and report an error if one isn't selected.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-19 21:50:26 +02:00
Tim Culverhouse ee964ad6b0 command/help: remove helpClose function
The helpClose function is used to call UpdateScreen on MessageViewer,
which has the effect of invalidating and redrawing the message view.
This logic is redundant with the addition of tcell-term and the main
event loop.

Remove the helpClose calls. Remove the UpdateScreen methods from
messageviewer: those functions are only used by the helpClose function.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Koni Marti <koni.marti@gmail.com>
2022-10-19 21:01:55 +02:00
Tim Culverhouse 3687b18149 terminal: bump tcell-term version
Upgrade tcell-term to v0.3.0.

- Fixes erase line handling
- Wide character support

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-19 21:01:55 +02:00
Tim Culverhouse 847c1cd3c3 terminal: properly handle cursor display
The terminal widget reports if the cursor should be displayed. Properly
handle this output to report cursor display back to aerc.

Reported-by: staceee
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-19 21:01:55 +02:00
Bence Ferdinandy c3bb3aa2a8 msgview: add separate date formatting
The ThisDayTimeFormat and friends are missing from the message view
which just uses the message list's default setting. This might not be
desirable since the amount of space available is different. Introduce
separate settings for formatting dates in the message view.

Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-19 20:27:58 +02:00
Koni Marti 6eed15c579 dirtree: fix folder scrolling
Fix scrolling by correcting the index calculation.

Fixes: https://todo.sr.ht/~rjarry/aerc/93
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
2022-10-19 20:27:24 +02:00
Robin Jarry ebcd6fcea1 lint: check for bad white space habits
A little coding hygiene cannot hurt. Add a simple awk script to check
all source files for bad white space habits:

- trailing white space
- trailing new lines at the end of files
- missing new line at the end of files
- spaces followed by tabs

The script outputs color when the terminal supports it. It exits with
a non-zero code when there was at least one white space issue found.
Call the script in the lint step.

Example output of the awk script:

 config/default_styleset:1:# <-- trailing whitespace
 config/default_styleset:3:# <-- trailing whitespace
 doc/aerc.1.scd:78:        Executes an arbitrary command in the background. Aerc will set the <-- trailing whitespace
 doc/aerc.1.scd:234:        <-- trailing whitespace
 doc/aerc.1.scd:237:        <-- trailing whitespace
 worker/types/thread_test.go:74:        //         return ErrSkipThread<-- space(s) followed by tab(s)
 worker/lib/testdata/message/invalid/hexa: trailing new line(s)

Fix issues reported by the script.

NB: The ENDFILE match is a GNU extension. It will be ignored on BSD-awk
and trailing new lines will not be detected. The lint make target is
only invoked on alpine linux which has GNU awk anyway.

NB: Empty cells in scdoc tables require trailing white space... Avoid
this by setting content in these cells. I don't really see a use for
empty cells.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Moritz Poldrack <moritz@poldrack.dev>
2022-10-19 10:19:19 +02:00
Ben Cohen b22639ab20 check-mail: update man page to for check-mail(-cmd) clarity
Update aerc(1) to state that check-mail-cmd is only required for using
check-mail within aerc.

Signed-off-by: Ben Cohen <ben@bencohen.net>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-18 22:25:46 +02:00
Ben Cohen f7a9454441 maildir: make checkmail update directory counts
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>
2022-10-18 22:25:46 +02:00
Tim Culverhouse bad694e466 ui: add :split and :vsplit view options
Add :split and :vsplit commands, which split the message list view to
include a message viewer. Each command takes an int, or a delta value
("+1", "-1"). The int value is the resulting size of the message list,
and a new message viewer will be displayed below / to the right of the
message list. This viewer *does not* set seen flags.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-18 22:25:35 +02:00
Tim Culverhouse 7016c6f86a aercmsg: add AercFuncMsg and QueueFunc
Introduce AercFuncMsg and QueueFunc. These are used in combination to
queue a function to be run in the main goroutine. This can be used to
prevent data races in delayed function calls (ie from debounce
functions).

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-18 22:20:44 +02:00
Tim Culverhouse 556f346f96 msgviewer: simplify filter and pager command handling
Refactor the filtering and paging logic to use several fewer goroutines.
Fixes data race condition with the timing of filter -> pager ->
terminal, can be found when switching message views fast.

Check if filter -> pager process is currently running before calling it
to start again. Fixes data race between fetching message body and
terminal starting. Both can initiate the copying process, and for long
running filters and fast message fetching, it is possible to have
fetched a message but still be running the filter when the terminal
starts.

Move StripAnsi to it's own file in lib/parse, similar to the hyperlinks
parser.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-18 22:20:37 +02:00
Jason Cox 7647dfb8b4 compose: warn before sending without attachment
Prevent the embarrassing forgotten attachment scenario by warning the
user before sending a message that may need an attachment but does not
have one. Whether a message needs an attachment is determined by testing
a configurable regex against the message body.

Signed-off-by: Jason Cox <dev@jasoncarloscox.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-10-17 22:41:00 +02:00