cpp: Add API to obtain mutliple remarks

* lang/cpp/src/key.cpp, lang/cpp/src/key.h (UserID::remarks): New.
* NEWS: Mention this.

--
This can be useful if we want to show remarks made by others, too.

For:
GnuPG-Bug-Id: T4734
This commit is contained in:
Andre Heinecke 2019-11-04 13:54:55 +01:00
parent db888b1cc0
commit cb7668caeb
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C
3 changed files with 21 additions and 0 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ Noteworthy changes in version 1.14.0 (unreleased)
* Interface changes relative to the 1.13.1 release: * Interface changes relative to the 1.13.1 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cpp: UserID::remark NEW. cpp: UserID::remark NEW.
cpp: UserID::remarks NEW.
cpp: GpgSignKeyEditInteractor::setDupeOk NEW. cpp: GpgSignKeyEditInteractor::setDupeOk NEW.
qt: SignKeyJob::setDupeOk NEW. qt: SignKeyJob::setDupeOk NEW.
qt: SignKeyJob::setRemark NEW. qt: SignKeyJob::setRemark NEW.

View File

@ -777,6 +777,22 @@ const char *UserID::remark(const Key &remarker, Error &err) const
return nullptr; return nullptr;
} }
std::vector<std::string> UserID::remarks(std::vector<Key> keys, Error &err) const
{
std::vector<std::string> ret;
for (const auto &key: keys) {
const char *rem = remark(key, err);
if (err) {
return ret;
}
if (rem) {
ret.push_back(rem);
}
}
return ret;
}
// //
// //
// class Signature // class Signature

View File

@ -430,6 +430,10 @@ public:
const char *remark(const Key &key, const char *remark(const Key &key,
Error &error) const; Error &error) const;
/*! Get multiple remarks made by potentially multiple keys. */
std::vector <std::string> remarks(std::vector<GpgME::Key> remarkers,
Error &error) const;
private: private:
shared_gpgme_key_t key; shared_gpgme_key_t key;
gpgme_user_id_t uid; gpgme_user_id_t uid;