Commit graph

995 commits

Author SHA1 Message Date
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
Leszek Cimała
e84e402e48 decode(RFC 2047) imap headers to fix encoding in subject & filenames
Me again,
this time fixing encoding of subjects and attachments. It was problem in
IMAP backend. While other backends user MessageInfo() function which
generates MessageInfo decoded via go-message methodes, IMAP worker is
creating MessageInfo directly, so all non-utf8 subjects and filenames
were in raw form.

This patch fixes it. Not sure if we should care about errors (if
DecodeHeader fails it returns raw string back).

>From what I see, this should solve all encoding problem (tested only
IMAP). So, now I can focus on features. ;-)

Have a great weekend!
Leszek
2019-12-07 14:30:33 -05:00
Leszek Cimała
30aa77c1c9 use correct headers for message part
Hello guys,
on the hunt for bugs related to wrong encoding. This patch is fixing
reply to non-utf8 messages.

We were using global message headers instead of part specific. In
practice header were often something like:

multipart; boundry=...

where there should be:

text/plain; charset=...

Fixed also missing SubType.

Have great weekend!

Leszek
2019-12-07 14:30:20 -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
Leszek Cimała
cd54bcd041 fix make install directiories permissions
Hi everyone!
On my system I have strict umask set, so make install creates them
unreadable by non-root. This trivial fix ensures, that directories are
created as expected.

Leszek
2019-12-07 14:29:57 -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
Rafael Castillo
74c13e84b7 Initialize an empty message map in the message store on initialization
This addresses occasional crashes when a `MessageInfo` event reached the message
store before `DirectoryContents`, particularly on slower (imap) accounts.
2019-12-07 14:29:36 -05:00
Drew DeVault
eef662c606 Revert "Parse headers from template"
This reverts commit 31e3e9f56e.
2019-12-04 09:49:53 -05:00
Wiktor Kwapisiewicz
abd9e78f02 Fix crash when no message is selected
Pressing `Enter` on a view that has not yet loaded messages (e.g. at
startup) would return `nil` from `Selected()`. Accessing `msg.Uid` on a
`nil` reference crashes aerc.

This patch moves the `msg == nil` check before accessing `msg.Uid` thus
avoiding the crash.

To test this patch repeatedly press `Enter` on startup.
2019-12-04 09:45:07 -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
Thorben Günther
c1d57977af Fix crash if there is no to address for %F 2019-11-25 11:49:46 -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
Drew DeVault
eff8208cd9 Update version to 0.3.0 2019-11-21 09:34:46 -05:00
Srivathsan Murali
c5bc97081f Install aerc-templates 2019-11-19 22:39:18 -05:00
Srivathsan Murali
59c24523af Parse Reply-To header while parsing envelope 2019-11-17 13:24:23 -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
Kevin Kuehler
4966b912c6 commands/account: Disable :view for deleted msgs
Allowing the user to view deleted messages creates all sorts of race
conditions. The most devious race condition is pv.source can be set to a
nil while another PartViewer is still running a goroutine in
attemptCopy.

Here is a trace when this happens.

goroutine 76 [running]: io.copyBuffer(0x7f8ad02641d0, 0xc00040f590, 0x0,
0x0, 0xc0007cc000, 0x8000, 0x8000, 0x0, 0x0, 0x8b3d60)
/usr/lib/go/src/io/io.go:402 +0x101 io.Copy(...)
/usr/lib/go/src/io/io.go:364
git.sr.ht/~sircmpwn/aerc/widgets.(*PartViewer).attemptCopy.func4(0xc00017efd0,
0xc0004da7c0) /home/keur/repos/aerc/widgets/msgviewer.go:576 +0x611
created by git.sr.ht/~sircmpwn/aerc/widgets.(*PartViewer).attemptCopy
/home/keur/repos/aerc/widgets/msgviewer.go:544 +0x144

We could add a guard in store.FetchBodyPart to only call the callback
when msg.Part.Reader != nil, but we still get a hanging pager. Therefore
it seems more reasonable to disable this completely.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-11-17 13:19:42 -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
Kevin Kuehler
8a848303fe worker/imap: Fix seqMap race condition
When deleting a message, sometimes FetchDirectoryContents will fire.
FetchDirectoryContents will return a smaller set of UIDs since messages
have been deleted. This operation races with fetching from the seqMap in
client.ExpungeUpdate. Only recreate the seqMap if it can grow so that
messages will continue to be expunged.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
2019-11-10 17:19:23 -05:00
Drew DeVault
08574104bc Correct capitalization in quoted_reply 2019-11-10 13:36:25 -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
Luke Drummond
331b915139 Add support for AUTH LOGIN submission
`go-sasl` upstream added support [1] for the obsolete [2] AUTH LOGIN
method which enables aerc to send email via servers which remain common
in the wild.

Fixes ~sircmpwn/aerc2#263

[1] https://github.com/emersion/go-sasl/commit/61afe53d
[2] https://datatracker.ietf.org/doc/draft-murchison-sasl-login/
2019-11-01 11:02:01 -04:00
Reto Brunner
6dc537fbe3 Notmuch: be resilient to config errors
Right now notmuch panics if something goes wrong in the configure event.
This patch checks for that and returns an error instead, so that we can at least
get the UI up and running (and all the other accounts)

The experience will be completely degraded until another configure event occurs.
2019-11-01 11:02:01 -04:00
Matt Snider
cd39e8f90c notmuch: ignore comments and blank lines when processing query-map file
A segmentation fault occurs when using the notmuch backend and a `query-map`
file that contains blank lines or comments.
2019-11-01 11:02:01 -04: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
Frode Aannevik
550ef0bc1f Fix: oauthbearer runtime error
Configure an oauthbearer source without a token_endpoint
parameter would panic due to nil pointer dereference

  Example
    source=imaps+oauthbearer://frode.aa%40gmail.com@imap.gmail.com:993
    source-cred-cmd=pass oatuh2 frode.aa@gmail.com

token_endpoint is not required as it will use the provided
password as access_token when it is not set
2019-10-16 11:04:41 -04:00
Reto Brunner
48a88fe44f lib/msgstore: fix invalid callback invocation
creating a directory must not invoke the callback, as this is meant for the
completion of the move
2019-10-14 10:38:05 -04:00
Jeffas
03d182ca88 Fix tab refocus on remove
Previously removing a tab would always pop from the history of tabs.
This checks to see if the closing tab is the one selected, if it is then
we use the history, otherwise we only need to change the selected tab if
it was after (to the right of) the closing tab, in which case we just
decrement the selected index.
2019-10-14 10:38:04 -04:00
Jeffas
2542c65af2 Fix pushing invalid tabs to history
A tab can now only be pushed onto the history if it is a selectable tab.
2019-10-14 10:38:02 -04:00
Drew DeVault
f1b365dfc3 Revert "Show spinner when fetching contents"
This reverts commit 1339faf788.
2019-10-09 19:57:53 -04:00
Jeffas
d3379dd7f0 Preserve sorting order in search results
This ensures that the search results follow the order of the current
sort so that cycling throught the results proceeds in displayed order.
2019-10-09 19:46:43 -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
Reto Brunner
f15811a737 Open mailto links in a new aerc instance if needed.
Aerc tries to open mailto:// links via the socket of the already running aerc
instance.

If no socket exists this silently errored out.
This commit starts up a new aerc instance if it can't connect to the socket
(which I think is the most common error) and if not sets up a new aerc instance
and retries to open the compositor.

This fixes https://todo.sr.ht/~sircmpwn/aerc2/295 by implementing the desired
behaviour.
2019-09-29 12:36:35 -04:00
Heiko Carrasco
70c16fc346 Print success to socket if no error was thrown
When Reto Brunners patch is applied (which works really well for me), the user gets to see the message
returned by AercServer. Since this is nil if no errors were thrown it
prints "result: <nil>" to the cmd. This patch fixes that by just
returning success instead of the error message when err != nil.
2019-09-29 12:36:34 -04:00
Srivathsan Murali
1bedb8fe06 Config for deleting message from message viewer
As suggested in #268, this adds a behaviour setting for
deleting message from message viewer.
2019-09-20 15:23:45 -04:00
Jeffas
043a02d99d Sort path completions 2019-09-20 15:07:05 -04:00
Jeffas
d2a18e267c Change search flags
This changes the search flags for maildir and imap backends.

They now no longer use -t for searching all text. This seems to make
more sense as being the targeted recipient. I have similarly added Cc
for -c. The text search now resides under -a for all text.
2019-09-20 15:06:54 -04:00
Jeffas
39307a6fa7 Make commands join args with spaces
This patch ensures the following commands join their arguments with
spaces to make it easier to interact with:

- cf
- mkdir
- cd
- attach
- detach
- ct
- copy
- move
- save
2019-09-20 15:06:34 -04:00
Reto Brunner
3ec9fd216d notmuch: add sort functionality 2019-09-20 15:01:07 -04:00
Jeffas
36af93b8f4 Add documentation for sort
This adds documentation for the config option and the command.
2019-09-20 14:56:02 -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