diff options
author | Andre Heinecke <[email protected]> | 2016-12-15 10:31:14 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2016-12-15 10:39:12 +0000 |
commit | 85e05537e15346896a271d3f62bead9dd7e3f180 (patch) | |
tree | f342b9a6b11203eb29b6b6519958f9d039a6d508 /lang/cpp/src/key.cpp | |
parent | cpp: Fix update of partial key in verifyresult (diff) | |
download | gpgme-85e05537e15346896a271d3f62bead9dd7e3f180.tar.gz gpgme-85e05537e15346896a271d3f62bead9dd7e3f180.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | lang/cpp/src/key.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index 235a3c8e..d621a81e 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() |