Commit graph

298 commits

Author SHA1 Message Date
Reto Brunner
9096049f75 FetchBodyParts: decode source in the workers
Previously the workers returned a mixture of decoded / encoded parts.
This lead to a whole bunch of issues.
This commit changes the msgviewer and the commands to assume parts to already
be decoded
2020-01-05 16:02:45 -05:00
Reto Brunner
126119c0b1 msgviewer: decode headers prior to displaying them 2020-01-05 16:02:42 -05:00
Reto Brunner
cb168682b3 msgviewer: bypass filter for headers 2020-01-05 16:02:41 -05:00
Reto Brunner
7a1770f129 msgviewer: do not anchor ansi escape to start of line 2020-01-05 16:02:39 -05:00
Reto Brunner
b360cca977 msgviewer: Add Labels as a virtual header
In order to accommodate for that, the headerlayout needed to be rewritten
to pass the filter criteria back to the msgviewer, instead of just using
the normal headers.
2019-12-27 10:20:30 -07:00
Reto Brunner
2705d8460d add LabelList event 2019-12-21 11:20:11 -05:00
Reto Brunner
b9d2938f9f msglist: highlight marked messages
Note that, until we get color configuration, this means that the user *must*
have the %Z verb in the index format else it'll be horribly confusing
as no visual indication is provided
2019-12-21 09:27:53 -05:00
Reto Brunner
3e535f49b3 msgviewer: implement ProvidesMessages interface 2019-12-21 09:27:49 -05:00
Reto Brunner
98418764b6 AccountView: implement ProvidesMessages 2019-12-21 09:27:48 -05:00
Reto Brunner
684978e77d widgets: add msgInfoFromUids helper 2019-12-21 09:27:47 -05:00
Reto Brunner
b57a47a74f add ProvidesMessages interface 2019-12-21 09:27:47 -05:00
Ben Burwell
fad375c673 Add address book completion in composer
Complete email address fields in the message composer with an external
address book command, compatible with mutt's query_cmd.
2019-12-21 09:23:22 -05:00
Ben Burwell
7160f98a90 Show textinput completions in popovers
Rather than showing completions inline in the text input, show them in a
popover which can be scrolled by repeatedly pressing the tab key. The
selected completion can be executed by pressing enter.
2019-12-21 09:23:21 -05:00
Ben Burwell
ef4c2f61d8 Use timestamp-format in msgviewer
This allows the time to be displayed in a user-configurable way. Also
localize the time in the message viewer as it is in the message list.
2019-12-19 08:45:26 +01:00
Drew DeVault
0ef4b6f9e2 Composer: fix EOF errors
PrepareHeaders generated a fresh message ID and Date header every time.
This instead generates those headers in advance.
2019-12-12 10:22:28 -05:00
Michele Finotto
dfe58842b9 Add custom sorting for folders
A new config options for accounts.conf (folders-sort) was added to
allow a user to choose which folders should be shown on top.
My use case was to avoid stepping into heavy, but rarely viewed folders
when cycling through other often accessed ones.

To test add this to your account.conf:

folders-sort  = INBOX,Sent,Archive

INBOX, Sent and Archive should then show at the top of your dirlist,
and all other folders should come next in alphabetical order.
2019-12-09 12:42:40 -05:00
Leszek Cimała
2559ebfac5 remove garbage headers in reply message
Very important fix. Remove garbage from reply message headers. Till
now all Original fields were send in reply, which we do not want and could
lead to uncorrect email message.
2019-12-08 14:40:36 -05:00
Leszek Cimała
4f2892695e failback to Content-Type filename when encoded Content-Disposition is used
Hi!
This patch will fix missing filename if it is RFC2231 encoded with charset
different then ASCII or UTF8. Example how it looks like in mail:

Content-Type: application/pdf;
 name="=?UTF-8?Q?Opis_przedmiotu_zam=c3=b3wienia_-_za=c5=82=c4=85cznik_nr_1?=
 =?UTF-8?Q?=2epdf?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0*=iso-8859-2''%4F%70%69%73%20%70%72%7A%65%64%6D%69%6F%74%75%20;
 filename*1*=%7A%61%6D%F3%77%69%65%6E%69%61%20%2D%20%7A%61%B3%B1%63%7A%6E;
 filename*2*=%69%6B%20%6E%72%20%31%2E%70%64%66

Yes, this should be forbidden :-). Anyway, best solotion in such cases
is to failback to Content-Type name. I am not sure if it is guaranted to
be there, but probably it will.

Leszek
2019-12-07 14:30:35 -05:00
ernierasta
0a1a75aed1 fix non-utf8 encoding in msgviewer
This patch should fix encoding problem with non-utf8 text/plain mime.
It is now correctly convert to utf8 before sending to pager. It will
also solve quoting such mails.

Leszek
2019-12-07 14:30:03 -05:00
Robert Günzler
e88cc08d79 Parse headers from template
This patch parses the processed template for headers and populates
matching header editors.
Those are then stripped from the template body before prepending the template
and remaining header fields to the composer content.

The main motivation for this is keeping receiver, sender and subject
lines in the template file and generating the message subject from the
date.
2019-12-07 14:29:48 -05:00
Drew DeVault
eef662c606 Revert "Parse headers from template"
This reverts commit 31e3e9f56e.
2019-12-04 09:49:53 -05:00
Robert Günzler
31e3e9f56e Parse headers from template
Parse the processed template for headers and populates matching header
editors accordingly.
Those are then stripped from the template body before prepending it
and remaining header fields to the composer content.

The motivation for this is keeping receiver, sender and subject
lines in the template file and generating the message subject with the
date functions.
2019-12-04 09:37:52 -05:00
Kevin Kuehler
06f81e8cd9 widgets/terminal: Reap more zombies
The editor and pager were not properly being reaped, causing resource
leakage whenever a user replies to a message.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-11-21 14:34:50 -05:00
Greg Anders
3338dce8a1 Allow fields in compose widget to be clicked
When the mouse is enabled, clicking on a header field switches focus to
that field (likewise for the terminal).
2019-11-17 13:19:47 -05:00
Srivathsan Murali
c655afa32b Complete the F rune.
%F now shows the auth name or recepient name/address if the
message is from you.
2019-11-17 13:19:20 -05:00
Greg Anders
4bdef7d860 Add UI options to save/pipe messages with unsupported mimetypes
Adds a message indicating the user's ability to :save or :pipe a message
with an unsupported mimetype and also adds a selector widget (similar to
the tutorial).

The selector widget was previously defined in the account wizard module,
so this commit breaks it out into its own module to allow for re-use.

Further, modify the BeginExLine() function to take an argument that
pre-populates the command line, allowing functions to initiate an ex
command without executing it.

Closes #95.
2019-11-17 13:19:13 -05:00
Greg Anders
809083f843 Check for terminal before forwarding mouse event
When viewing a message part with no available filter, clicking the UI
would cause a nil pointer dereference because the MouseEvent was passed
to the PartViewer's `term` field, which does not exist in the case of an
absent filter.
2019-11-17 13:19:11 -05:00
Drew DeVault
cb7d7a0438 Add some defaults for template options 2019-11-10 11:00:21 -05:00
Srivathsan Murali
3ba69edab5 Add Templates with Parsing
+ Changes NewComposer to return error.
+ Add lib to handle templates using "text/template".
+ Add -T option to following commands
    - compose.
    - reply
    - forward
+ Quoted replies using templates.
+ Forwards as body using templates
+ Default templates are installed similar to filters.
+ Templates Config in aerc.conf.
    - Required templates are parsed while loading config.
+ Add aerc-templates.7 manual for using template data.
2019-11-10 10:15:49 -05:00
Kevin Kuehler
ad68a9e4e4 widgets/msgviewer: Don't crash if pager is nil
Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-11-10 10:11:34 -05:00
Kevin Kuehler
310bec2702 widgets/msgview: Reap the filter command
The filter command shells out and returns almost immediately. Call
Wait() so the filter process gets reaped. Prior to this patch, aerc
creates a zombie process for every email that is viewed.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-10-16 11:13:54 -04:00
Kevin Kuehler
be4ea0d96b Cleanup pager processes after closing a msgviewer
A pager is spawned every time an email is viewed but not killed off when
quitting the msgviewer, thus leading to process leakage. This patch
fixes this by adding a Close method to the msgview widget, which is
called in the close command.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-10-16 11:13:53 -04:00
Drew DeVault
f1b365dfc3 Revert "Show spinner when fetching contents"
This reverts commit 1339faf788.
2019-10-09 19:57:53 -04:00
Jeffas
1339faf788 Show spinner when fetching contents
The spinner should be shown when fetching the contents as we don't know
at that point whether there are some messages or not.
2019-10-09 19:46:43 -04:00
Jeffas
00b9ca5032 Fix selected account to return for messageviewer
This ensures that the selectedaccount is returned if currently selected
tab is a messageviewer. This also makes it more extensible for adding
other ways of getting the selected account.
2019-10-02 15:40:23 -04:00
Jeffas
90d26da58a Add sorting functionality
There is a command and config option. The criteria are a list of the
sort criterion and each can be individually reversed.

This only includes support for sorting in the maildir backend currently.
The other backends are not supported in this patch.
2019-09-20 14:56:02 -04:00
Drew DeVault
956f1366a5 Revert "Fix out-of-order messages by sorting as we display"
This reverts commit ac99d9ed62.
2019-09-18 10:21:45 -04:00
Wagner Riffel
ecc26b53c9 widgets: remove duplicate import
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-09-12 23:42:08 -04:00
Jeffas
e2d5c456dc Add signatures
This adds the ability for per-account signatures in the accounts.conf
config file. The signature is added to emails in the editor at the
bottom of the email. This includes when forwarding, replying to, and
composing emails.

There are two config options: signature-file and signature-cmd. The
former allows a signature to be read from a file and the latter allows
an arbitrary command to be executed to return the signature.

The config options have been documented in aerc-config
2019-09-12 16:18:34 -04:00
Reto Brunner
a93b4de6f3 Add modify-labels command
This adds the event type as well as the command implementation, but no backend
supports it yet.
2019-09-12 16:17:24 -04:00
Jeffas
618a500341 Add display of unread messages in dirlist
Add an onUpdateDirs handler. This is used to invalidate the dirlist and
redraw with the correct number of recent/unread/total messages is shown.

A config option and formatting options are provided.
2019-09-11 12:37:43 -04:00
Devon Johnson
572d9ff728 Fix segfault on delete 2019-09-11 12:24:37 -04:00
Jeffas
f6216bb621 Add Mouseable
This adds the Mouseable interface. When this is implemented for a
component that item can accept and process mouseevents.

At the top level when a mouse event is received it is passed to the
grid's handler and then it trickles down until it reaches a component
that can actually handle it, such as the tablist, dirlist or msglist.

A mouse event is passed so that components can handle other things such
as scrolling with the mousewheel. The components themselves then perform
the necessary actions.

Clicking emails in the messagelist opens them in a new tab.

Textinputs can be clicked to position the cursor inside them.

Mouseevents are not forwarded to the terminal at the moment.

Elements which do not handle mouse events are not required to implement
the Mouseable interface.
2019-09-11 11:41:34 -04:00
Wagner Riffel
e28f45b5aa widgets: gofmt
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-09-04 16:30:57 -10:00
Wagner Riffel
1d04c2a292 widgets: rewrite references to os.SET_SEEK to io.SeekStart
Os.SET_SEEK is deprecated, it's recommended to use contants from io
package

Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-09-04 16:30:57 -10:00
Wagner Riffel
6838c23478 all: purge redundant underscores
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-09-04 16:30:57 -10:00
a3v
2257b29a82 Use sort.Stable for sorting displayed messages
With sort.Sort, sometimes two messages with the same timestamp will switch
places every time the message list is redrawn
2019-09-02 10:27:54 +09:00
Paul Spooren
e4104a8674 Allow custom spinner via config file
Allows to set `ui.spinner=` to a string which is then split by
`ui.spinner-delimiter=` (Default: comma) instead of having a hard coded
animation.

This implementation doesn't use INIs capabilities to split strings as
it trims whitespaces breaking the default animation.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2019-08-30 10:32:28 +09:00
Stephen Brennan
ac99d9ed62 Fix out-of-order messages by sorting as we display
Sometimes I observe out-of-order messages when using a maildir inbox. It
appears that the UIDs for these messages are returned out of order by
the MessageStore. In order for a maildir MessageStore to return messages
in most recently received order, it must have already opened all
messages and parsed the date to use as a sort key. Rather than implement
that, simply sort messages by time as we display. This fix shows my
emails in order.
2019-08-29 08:44:08 +09:00
Christopher Vittal
ecd803aae4 Add :prompt command
Usage:
    :prompt <prompt> <command...>

Displays the prompt on the status bar, waits for user input, then
appends that input as the last argument to the command and executes it.
The input is passed as one argument to the command, unless it is empty,
in which case no extra argument is added.
2019-08-26 09:48:39 +09:00