aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2016-12-16 18:09:13 +0000
committerAndre Heinecke <[email protected]>2016-12-16 18:09:13 +0000
commitda5343a9d2c8c0ca6431162aac4bd5c73b4ae6dd (patch)
treee62652081d8f011eeed4540daf55e82692b7e77d /lang/cpp
parentcpp: Fix addrSpec for keys without email (diff)
downloadgpgme-da5343a9d2c8c0ca6431162aac4bd5c73b4ae6dd.tar.gz
gpgme-da5343a9d2c8c0ca6431162aac4bd5c73b4ae6dd.zip
cpp: Ensure that hasSecret is correct after update
* lang/cpp/src/key.cpp (Key::update): Check for a secret key first before listing public keys. -- This is a performance delay but the update should only be called in a non gui thread anyway. The information if we have the secret key for this key is important to provide after update.
Diffstat (limited to '')
-rw-r--r--lang/cpp/src/key.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index d621a81e..4f7ec54b 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -341,7 +341,12 @@ void Key::update()
KeyListMode::Validate |
KeyListMode::WithTofu);
Error err;
- auto newKey = ctx->key(primaryFingerprint(), err, hasSecret());
+ auto newKey = ctx->key(primaryFingerprint(), err, true);
+ // Not secret so we get the information from the pubring.
+ if (newKey.isNull())
+ {
+ newKey = ctx->key(primaryFingerprint(), err, false);
+ }
delete ctx;
if (err) {
return;