aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/gpg/GpgUIDOperator.cpp
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2022-05-08 13:14:24 +0000
committerGitHub <[email protected]>2022-05-08 13:14:24 +0000
commitf722eec9a898c97e233619a50f6f1a94fef6f94c (patch)
tree26757206ff3e139a10968bd8ae6147ca1a1182a7 /src/core/function/gpg/GpgUIDOperator.cpp
parentMerge pull request #50 from saturneric/develop-2.0.5 (diff)
parentdoc: update translate document. (diff)
downloadGpgFrontend-f722eec9a898c97e233619a50f6f1a94fef6f94c.tar.gz
GpgFrontend-f722eec9a898c97e233619a50f6f1a94fef6f94c.zip
Merge pull request #54 from saturneric/develop-2.0.6v2.0.6
Develop 2.0.6
Diffstat (limited to 'src/core/function/gpg/GpgUIDOperator.cpp')
-rw-r--r--src/core/function/gpg/GpgUIDOperator.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp
index dd0c43f6..33c29fa4 100644
--- a/src/core/function/gpg/GpgUIDOperator.cpp
+++ b/src/core/function/gpg/GpgUIDOperator.cpp
@@ -30,8 +30,11 @@
#include "boost/format.hpp"
+GpgFrontend::GpgUIDOperator::GpgUIDOperator(int channel)
+ : SingletonFunctionObject<GpgUIDOperator>(channel) {}
+
bool GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key,
- const std::string& uid) {
+ const std::string& uid) {
auto err = gpgme_op_adduid(ctx_, gpgme_key_t(key), uid.c_str(), 0);
if (check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR)
return true;
@@ -40,7 +43,7 @@ bool GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key,
}
bool GpgFrontend::GpgUIDOperator::RevUID(const GpgFrontend::GpgKey& key,
- const std::string& uid) {
+ const std::string& uid) {
auto err =
check_gpg_error(gpgme_op_revuid(ctx_, gpgme_key_t(key), uid.c_str(), 0));
if (check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR)
@@ -50,7 +53,7 @@ bool GpgFrontend::GpgUIDOperator::RevUID(const GpgFrontend::GpgKey& key,
}
bool GpgFrontend::GpgUIDOperator::SetPrimaryUID(const GpgFrontend::GpgKey& key,
- const std::string& uid) {
+ const std::string& uid) {
auto err = check_gpg_error(gpgme_op_set_uid_flag(
ctx_, gpgme_key_t(key), uid.c_str(), "primary", nullptr));
if (check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR)
@@ -59,9 +62,9 @@ bool GpgFrontend::GpgUIDOperator::SetPrimaryUID(const GpgFrontend::GpgKey& key,
return false;
}
bool GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key,
- const std::string& name,
- const std::string& comment,
- const std::string& email) {
+ const std::string& name,
+ const std::string& comment,
+ const std::string& email) {
LOG(INFO) << "GpgFrontend::UidOperator::AddUID" << name << comment << email;
auto uid = boost::format("%1%(%2%)<%3%>") % name % comment % email;
return AddUID(key, uid.str());