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.
This commit is contained in:
parent
5673f3e54a
commit
85e05537e1
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user