From e416f9961837039f259558edf41fccbc181ad128 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Wed, 11 Jan 2017 16:14:45 +0100 Subject: cpp: Add revuid and adduid support * lang/cpp/src/context.cpp (Context::revUid, Context::startRevUid), (Context::addUid, Context::startAddUid): New. * lang/cpp/src/context.h: Declare new functions. * lang/cpp/src/key.cpp (Key::UserID::revoke) (Key::addUid): Idomatic helpers. lang/cpp/src/key.h: Declare new functions. * NEWS: Update accordingly. --- lang/cpp/src/key.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lang/cpp/src/key.cpp') diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index 4f7ec54b..3cc26a77 100644 --- a/lang/cpp/src/key.cpp +++ b/lang/cpp/src/key.cpp @@ -906,6 +906,34 @@ std::string UserID::addrSpec() const return uid->address; } +Error UserID::revoke() +{ + if (isNull()) { + return Error::fromCode(GPG_ERR_GENERAL); + } + auto ctx = Context::createForProtocol(parent().protocol()); + if (!ctx) { + return Error::fromCode(GPG_ERR_INV_ENGINE); + } + Error ret = ctx->revUid(key, id()); + delete ctx; + return ret; +} + +Error Key::addUid(const char *uid) +{ + if (isNull()) { + return Error::fromCode(GPG_ERR_GENERAL); + } + auto ctx = Context::createForProtocol(protocol()); + if (!ctx) { + return Error::fromCode(GPG_ERR_INV_ENGINE); + } + Error ret = ctx->addUid(key, uid); + delete ctx; + return ret; +} + std::ostream &operator<<(std::ostream &os, const UserID &uid) { os << "GpgME::UserID("; -- cgit v1.2.3