cpp: Add support for gpgme_op_tofu_policy
* src/context.cpp, src/context.h (setTofuPolicy, setTofuPolicyStart): New.
This commit is contained in:
parent
32baac8cde
commit
4d384d7bfe
@ -41,6 +41,7 @@
|
|||||||
#include "data_p.h"
|
#include "data_p.h"
|
||||||
#include "context_p.h"
|
#include "context_p.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "tofuinfo.h"
|
||||||
|
|
||||||
#include <gpgme.h>
|
#include <gpgme.h>
|
||||||
|
|
||||||
@ -1329,6 +1330,36 @@ Error Context::setPinentryMode(PinentryMode which)
|
|||||||
return Error(d->lasterr = gpgme_set_pinentry_mode(d->ctx, mode));
|
return Error(d->lasterr = gpgme_set_pinentry_mode(d->ctx, mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gpgme_tofu_policy_t to_tofu_policy_t(unsigned int policy)
|
||||||
|
{
|
||||||
|
switch (policy) {
|
||||||
|
case TofuInfo::PolicyNone:
|
||||||
|
return GPGME_TOFU_POLICY_NONE;
|
||||||
|
case TofuInfo::PolicyAuto:
|
||||||
|
return GPGME_TOFU_POLICY_AUTO;
|
||||||
|
case TofuInfo::PolicyGood:
|
||||||
|
return GPGME_TOFU_POLICY_GOOD;
|
||||||
|
case TofuInfo::PolicyBad:
|
||||||
|
return GPGME_TOFU_POLICY_BAD;
|
||||||
|
case TofuInfo::PolicyAsk:
|
||||||
|
return GPGME_TOFU_POLICY_ASK;
|
||||||
|
case TofuInfo::PolicyUnknown:
|
||||||
|
return GPGME_TOFU_POLICY_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Error Context::setTofuPolicy(const Key &k, unsigned int policy)
|
||||||
|
{
|
||||||
|
return Error(d->lasterr = gpgme_op_tofu_policy(d->ctx,
|
||||||
|
k.impl(), to_tofu_policy_t(policy)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Error Context::setTofuPolicyStart(const Key &k, unsigned int policy)
|
||||||
|
{
|
||||||
|
return Error(d->lasterr = gpgme_op_tofu_policy_start(d->ctx,
|
||||||
|
k.impl(), to_tofu_policy_t(policy)));
|
||||||
|
}
|
||||||
|
|
||||||
// Engine Spawn stuff
|
// Engine Spawn stuff
|
||||||
Error Context::spawn(const char *file, const char *argv[],
|
Error Context::spawn(const char *file, const char *argv[],
|
||||||
Data &input, Data &output, Data &err,
|
Data &input, Data &output, Data &err,
|
||||||
|
@ -214,6 +214,10 @@ public:
|
|||||||
GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
|
GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
|
||||||
GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
|
GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
|
||||||
|
|
||||||
|
// using TofuInfo::Policy
|
||||||
|
Error setTofuPolicy(const Key &k, unsigned int policy);
|
||||||
|
Error setTofuPolicyStart(const Key &k, unsigned int policy);
|
||||||
|
|
||||||
EditInteractor *lastEditInteractor() const;
|
EditInteractor *lastEditInteractor() const;
|
||||||
std::unique_ptr<EditInteractor> takeLastEditInteractor();
|
std::unique_ptr<EditInteractor> takeLastEditInteractor();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user