diff options
Diffstat (limited to 'commands/compose')
-rw-r--r-- | commands/compose/encrypt.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/commands/compose/encrypt.go b/commands/compose/encrypt.go new file mode 100644 index 00000000..d63940b8 --- /dev/null +++ b/commands/compose/encrypt.go @@ -0,0 +1,44 @@ +package compose + +import ( + "errors" + "time" + + "git.sr.ht/~rjarry/aerc/widgets" +) + +type Encrypt struct{} + +func init() { + register(Encrypt{}) +} + +func (Encrypt) Aliases() []string { + return []string{"encrypt"} +} + +func (Encrypt) Complete(aerc *widgets.Aerc, args []string) []string { + return nil +} + +func (Encrypt) Execute(aerc *widgets.Aerc, args []string) error { + if len(args) != 1 { + return errors.New("Usage: encrypt") + } + + composer, _ := aerc.SelectedTab().(*widgets.Composer) + + composer.SetEncrypt(!composer.Encrypt()) + + var statusline string + + if composer.Encrypt() { + statusline = "Message will be encrypted." + } else { + statusline = "Message will not be encrypted." + } + + aerc.PushStatus(statusline, 10*time.Second) + + return nil +} |