[Pkg-gnupg-commit] [gpgme] 13/132: cpp: Fix addrSpec for keys without email
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 26 01:00:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gpgme.
commit 85e05537e15346896a271d3f62bead9dd7e3f180
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Thu Dec 15 11:31:14 2016 +0100
cpp: Fix addrSpec for keys without email
* lang/cpp/src/key.cpp (UserID::addrSpec): Use uid->address instead
of normalizing again.
(&operator<<(std::ostream &, const UserID &): Print it.
--
This saves a normalization and fixes the case where a user id
is just a mail address without name, in that case gpgme sets
"address" but not email. Because the email is then the name.
---
lang/cpp/src/key.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 235a3c8..d621a81 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -894,7 +894,11 @@ std::string UserID::addrSpecFromString(const char *userid)
std::string UserID::addrSpec() const
{
- return addrSpecFromString(email());
+ if (!uid || !uid->address) {
+ return std::string();
+ }
+
+ return uid->address;
}
std::ostream &operator<<(std::ostream &os, const UserID &uid)
@@ -903,6 +907,7 @@ std::ostream &operator<<(std::ostream &os, const UserID &uid)
if (!uid.isNull()) {
os << "\n name: " << protect(uid.name())
<< "\n email: " << protect(uid.email())
+ << "\n mbox: " << uid.addrSpec()
<< "\n comment: " << protect(uid.comment())
<< "\n validity: " << uid.validityAsString()
<< "\n revoked: " << uid.isRevoked()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git
More information about the Pkg-gnupg-commit
mailing list