diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/compose.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/widgets/compose.go b/widgets/compose.go index 1a59bd3a..aad566f5 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -1483,11 +1483,25 @@ func (c *Composer) checkEncryptionKeys(_ string) bool { mk = append(mk, rcpt) } } - if len(mk) > 0 { + switch { + case len(mk) > 0: c.SetEncrypt(false) st := fmt.Sprintf("Cannot encrypt, missing keys: %s", strings.Join(mk, ", ")) + if c.Config().PgpOpportunisticEncrypt { + switch c.Config().PgpErrorLevel { + case config.PgpErrorLevelWarn: + c.aerc.statusline.PushWarning(st) + return false + case config.PgpErrorLevelNone: + return false + case config.PgpErrorLevelError: + // Continue to the default + } + } c.aerc.statusline.PushError(st) return false + case len(rcpts) == 0: + return false } // If callbacks were registered, encrypt will be set when user removes // recipients with missing keys |