Commit graph

82 commits

Author SHA1 Message Date
ARaspiK
fe1cabb077 Add support for :rmdir
The `:rmdir` command removes the current directory (`-f` is required if
the directory is not empty).

This is not supported on the notmuch backend.

An issue with the maildir backend is that some sync programs (e.g.
offlineimap) may recover the directory after it is deleted.  They need
to specifically be configured to accept deletions, or special commands
need to be executed (e.g. `offlineimap --delete-folder`) to properly
delete folders.

A danger of using this on the IMAP backend is that it is possible for a
new message to be added to the directory and for aerc to not show it
immediately (due to a slow connection) - using `:rmdir` at this moment
(with `-f` if the directory already contains messages) would delete the
directory and the new message that just arrived (and all other
contents).  This is documented in aerc(1) so that users are aware of
possible risks.
2020-08-19 11:38:57 +02:00
Reto Brunner
8446d48664 run go fmt 2020-07-17 17:50:24 +02:00
Heiko Carrasco
749dbb93a4 Use PushStatus instead of SetStatus where it makes sense 2020-07-09 08:37:01 +02:00
Jeffas
15b72df1da Rework msglist scrolling
This changes the scrolling to be done on the draw, when the height is
updated, ensuring that the selected item is kept on screen during
resizing.

Also, this ensures that messages will fill the screen when resizing the
window, for instance, shrinking and then growing drags down more
messages if possible.

This is a transplant of the dirlist scrolling logic.
2020-06-09 21:52:10 +02:00
Drew DeVault
caad1b2c06 Revert "Add Style configuration"
This reverts commit 0f78f06610.
2020-05-28 10:32:42 -04:00
Drew DeVault
76a91813d8 Revert "Remove duration from the status methods"
This reverts commit f06d683688.
2020-05-28 10:32:32 -04:00
Reto Brunner
f06d683688 Remove duration from the status methods
We always set 10 seconds anyhow, might as well do that without repeating ourselfs.
2020-05-27 08:11:40 +02:00
Reto Brunner
0f78f06610 Add Style configuration
The following functionalities are added to configure aerc ui styles.
- Read stylesets from file with very basic fnmatch wildcard matching
- Add default styleset
- Support different stylesets as part of UiConfig allowing contextual
  styles.
- Move widgets/ui elements to use the stylesets.
- Add configuration manual for the styleset
2020-05-27 07:57:10 +02:00
Ray Ganardi
58db517c8d pgp: fail gracefully from email decryption
Aerc panics when there's an error on email decryption.
Instead, an error message should be shown.
2020-05-25 09:30:20 -04:00
Drew DeVault
6f8ad91824 gofmt fixes 2020-04-24 12:59:40 -04:00
Jeffas
3102ac3680 Add recall command
This command allows recalling the selected postponed email to edit in
the composer. The command only allows recalling from the postpone
directory.
2020-04-24 12:59:21 -04:00
Jeffas
7f033278eb Add postpone command
This command uses the Postpone folder from the account config to save
messages to. Messages are saved as though they were sent so have a valid
'to' recipient address and should be able to be read back in for later
editing.
2020-04-24 12:59:21 -04:00
Reto Brunner
acf69b7490 Remove ability to specify headers in the editor
Due to headers being essentially free text, we constantly run into issues
with parts of the body being interpreted as headers.

Remove the ability to overwrite headers to avoid that, while keeping the ability
to specify headers in the template files.

Fixes #383
2020-04-24 12:59:21 -04:00
Ben Fiedler
7c89143c70 Use aerc.PushError where appropriate
Forgot an unused import, to save you the hassle here is v2.
2020-04-23 21:02:45 +02:00
Drew DeVault
f3158b36f1 Initial support for PGP decryption & signatures 2020-03-03 16:49:52 -05:00
Leszek Cimała
bf28e23933 create OriginalMail struct 2020-01-09 14:31:19 -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
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
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
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
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
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
Wagner Riffel
bdb5e3e658 commands: move ParseNextPrevMessage error value to its last return value
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-09-04 16:30:57 -10:00
Wagner Riffel
baa70469c3 all: rewrite references to strings.Index to strings.Contains
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2019-09-04 16:30:57 -10:00
Wagner Riffel
feacca3c5c all: use fmt.Errorf for fomartting errors
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
Reto Brunner
94b9d557de extract search criteria parsing into the backends 2019-08-29 08:44:10 +09:00
Daniel Bridges
72204d1f24 Add optional body argument to compose command 2019-08-13 10:49:34 +09:00
Ben Cohen
4d95676274 Joining the args in cf for folders with spaces 2019-08-12 09:02:24 +09:00
Jelle Besseling
4478c6a4b7 Ignore scroll command when msgstore is nil
Fixes ~sircmpwn/aerc2#205. Many functions do a nil check on the store,
so this changes Store() so it returns nil when msglist is nil.

It also places the Scroll() behind the nil check in the next-message command.

https://todo.sr.ht/~sircmpwn/aerc2/205
2019-08-12 08:58:57 +09:00
Daniel Bridges
5b523880b4 Let user edit arbitrary headers in composer 2019-08-12 08:57:04 +09:00
Jelle Besseling
507c90537c Implement next-message in msgview using account
This makes sure that the next-message command accepts the same arguments
in the account view and the msgview
2019-08-07 15:10:24 +09:00
Jelle Besseling
3650b72ca6 Implement next-folder using NextPrev with amount
This fixes ~sircmpwn/aerc2#182

https://todo.sr.ht/~sircmpwn/aerc2/182
2019-08-07 15:02:11 +09:00
Reto Brunner
3424c36d52 ChangeFolder: do not depend on the msgstore
We need to clear the filtering etc upon folder switch.
Not having a valid msgstore is however no reason not to switch directories.
2019-08-02 09:26:10 -04:00
Daniel Bridges
67fb0938a6 Support configurable header layout in compose widget 2019-07-26 14:22:04 -04:00
Kevin Kuehler
f81e4bd41c Implement :filter, :clear
Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
2019-07-19 11:30:32 -04:00
Kevin Kuehler
8bb115dbae commands: Don't crash when store is nil
On a slow network connection, running these commands without this guard
will cause aerc to panic.

Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
2019-07-15 09:46:49 -04:00
Drew DeVault
363aab5cc1 Make :pipe command more generic 2019-07-05 12:21:12 -04:00
Gregory Mullen
f9d26eef58 Add IMAP folder tab completion
Credit for this fix goes to Reto; I guess if we're not gonna be mutt
we should probabaly do things correctly.
2019-07-04 11:28:04 -04:00
Gregory Mullen
2a0961701c Implement basic tab completion support
Tab completion currently only works on commands. Contextual completion
will be added in the future.
2019-06-29 14:24:19 -04:00
Drew DeVault
91a75cd98b Implement :search, :next-result, :prev-result 2019-06-26 20:50:54 -04:00
Martin Hafskjold Thoresen
53df15ae06 Insert nil check before handling prev/next message
If these are called before the store is setup, `acct.Store()` returns
`nil`, and we SEGFAULT in `MessageStore.nextPrev`.
2019-06-18 19:39:42 -04:00
Kevin Kuehler
9746f4858c commands/msgview: Add next/prev commands
Signed-off-by: Kevin Kuehler <kkuehler@brave.com>
2019-06-11 09:34:48 -04:00
Drew DeVault
d22a9140cd Implement :mkdir command 2019-06-09 19:21:26 -04:00
Kevin Kuehler
753adb9069 widget: Add ProvidesMessage interface
Consists of 3 functions
* Store: Access to MessageStore type
* SelectedAccount: Access to Account widget that the target widget
belongs to
* SelectedMessage: Current message (selected in msglist or the one we
are viewing)

Signed-off-by: Kevin Kuehler <keur@ocf.berkeley.edu>
2019-06-02 10:16:29 -04:00
Drew DeVault
1894a7e91b Fix infinite recursion in reply.go:findPlaintext 2019-06-02 09:36:21 -04:00
Drew DeVault
cf50b98768 Fetch plaintext part when replying 2019-06-01 19:47:09 -04:00
Galen Abell
28fc9fa53d Add :save and :pipe commands to viewer
* :save takes a path and saves the current message part to that location
* :pipe is the same as pipe on the account page, but uses the current
  message part rather than the whole email (ie :pipe gzip -d)
* Refactored account:pipe and extracted common pipe code to
  commands.util.QuickTerm
* Added helper command aerc.PushError
2019-05-27 09:37:07 -04:00
Drew DeVault
38e71659ff Implement :forward 2019-05-25 14:52:57 -04:00
Drew DeVault
cef784bf52 Fix special characters in address.PersonalName 2019-05-25 11:56:56 -04:00