summaryrefslogtreecommitdiff
path: root/widgets/pgpinfo.go
diff options
context:
space:
mode:
authorRay Ganardi <ray@ganardi.xyz>2020-05-19 13:06:49 +0200
committerDrew DeVault <sir@cmpwn.com>2020-05-25 09:30:20 -0400
commita31d184ba53a9a61b8a0eed42cee52f9b1f2dc51 (patch)
tree36d261e41182a7d39c7ff1a93e95cb9d38acbcc7 /widgets/pgpinfo.go
parent94e8d8f7bf5d4efb72dffb15e46a2a7d07bf4afb (diff)
downloadaerc-a31d184ba53a9a61b8a0eed42cee52f9b1f2dc51.zip
aerc: Refactor getpasswd dialog
Previously there's a hack for showing and hiding the dialog. Change it to use channels to emulate async/await
Diffstat (limited to 'widgets/pgpinfo.go')
-rw-r--r--widgets/pgpinfo.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/widgets/pgpinfo.go b/widgets/pgpinfo.go
index dc03cf6..5da9141 100644
--- a/widgets/pgpinfo.go
+++ b/widgets/pgpinfo.go
@@ -41,11 +41,8 @@ func (p *PGPInfo) DrawSignature(ctx *ui.Context) {
p.details.SignatureError.Error())
} else {
entity := p.details.SignedBy.Entity
- var ident *openpgp.Identity
- // TODO: Pick identity more intelligently
- for _, ident = range entity.Identities {
- break
- }
+ ident := entity.PrimaryIdentity()
+
x := ctx.Printf(0, 0, validStyle, "✓ Authentic ")
x += ctx.Printf(x, 0, tcell.StyleDefault,
"Signature from %s (%8X)",
@@ -56,11 +53,7 @@ func (p *PGPInfo) DrawSignature(ctx *ui.Context) {
func (p *PGPInfo) DrawEncryption(ctx *ui.Context, y int) {
validStyle := tcell.StyleDefault.Foreground(tcell.ColorGreen).Bold(true)
entity := p.details.DecryptedWith.Entity
- var ident *openpgp.Identity
- // TODO: Pick identity more intelligently
- for _, ident = range entity.Identities {
- break
- }
+ ident := entity.PrimaryIdentity()
x := ctx.Printf(0, y, validStyle, "✓ Encrypted ")
x += ctx.Printf(x, y, tcell.StyleDefault,