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
This commit is contained in:
parent
3d7810e8d9
commit
bbaeeb5b9d
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#include <gpgme.h>
|
#include <gpgme.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -799,6 +800,22 @@ Error Context::startKeyImport(const std::vector<Key> &kk)
|
|||||||
return err;
|
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
|
ImportResult Context::importResult() const
|
||||||
{
|
{
|
||||||
if (d->lastop & Private::Import) {
|
if (d->lastop & Private::Import) {
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "verificationresult.h" // for Signature::Notation
|
#include "verificationresult.h" // for Signature::Notation
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
@ -225,8 +226,10 @@ public:
|
|||||||
|
|
||||||
ImportResult importKeys(const Data &data);
|
ImportResult importKeys(const Data &data);
|
||||||
ImportResult importKeys(const std::vector<Key> &keys);
|
ImportResult importKeys(const std::vector<Key> &keys);
|
||||||
|
ImportResult importKeys(const std::vector<std::string> &keyIds);
|
||||||
GpgME::Error startKeyImport(const Data &data);
|
GpgME::Error startKeyImport(const Data &data);
|
||||||
GpgME::Error startKeyImport(const std::vector<Key> &keys);
|
GpgME::Error startKeyImport(const std::vector<Key> &keys);
|
||||||
|
GpgME::Error startKeyImport(const std::vector<std::string> &keyIds);
|
||||||
ImportResult importResult() const;
|
ImportResult importResult() const;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user