diff options
author | Ingo Klöcker <[email protected]> | 2022-02-02 10:07:53 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2022-02-03 14:56:30 +0000 |
commit | bbaeeb5b9d5cca99c332cb88c7ae5f14e8745427 (patch) | |
tree | b4fffe9c249b3af8cd31dd9e934d5203d88165ef /lang/cpp/src/context.cpp | |
parent | cpp: Add internal adapter for passing a vector of strings to gpgme (diff) | |
download | gpgme-bbaeeb5b9d5cca99c332cb88c7ae5f14e8745427.tar.gz gpgme-bbaeeb5b9d5cca99c332cb88c7ae5f14e8745427.zip |
cpp: Allow import of keys given by key ids
* lang/cpp/src/context.h (class Context): Add overloads of member
functions importKeys and startKeyImport
* lang/cpp/src/context.cpp (class Context): ... and implement them.
--
GnuPG-bug-id: 5808
Diffstat (limited to 'lang/cpp/src/context.cpp')
-rw-r--r-- | lang/cpp/src/context.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp index e8e57dc8..50726816 100644 --- a/lang/cpp/src/context.cpp +++ b/lang/cpp/src/context.cpp @@ -50,6 +50,7 @@ #include <gpgme.h> +#include <functional> #include <istream> #include <numeric> #ifndef NDEBUG @@ -799,6 +800,22 @@ Error Context::startKeyImport(const std::vector<Key> &kk) return err; } +ImportResult Context::importKeys(const std::vector<std::string> &keyIds) +{ + d->lastop = Private::Import; + const StringsToCStrings keyids{keyIds}; + d->lasterr = gpgme_op_receive_keys(d->ctx, keyids.c_strs()); + return ImportResult(d->ctx, Error(d->lasterr)); +} + +Error Context::startKeyImport(const std::vector<std::string> &keyIds) +{ + d->lastop = Private::Import; + const StringsToCStrings keyids{keyIds}; + d->lasterr = gpgme_op_receive_keys_start(d->ctx, keyids.c_strs()); + return Error(d->lasterr); +} + ImportResult Context::importResult() const { if (d->lastop & Private::Import) { |