aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/gpg/GpgUIDOperator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/function/gpg/GpgUIDOperator.cpp')
-rw-r--r--src/core/function/gpg/GpgUIDOperator.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp
index d74cea76..61e8c54c 100644
--- a/src/core/function/gpg/GpgUIDOperator.cpp
+++ b/src/core/function/gpg/GpgUIDOperator.cpp
@@ -33,38 +33,31 @@
GpgFrontend::GpgUIDOperator::GpgUIDOperator(int channel)
: SingletonFunctionObject<GpgUIDOperator>(channel) {}
-bool GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key,
- const std::string& uid) {
- auto err = gpgme_op_adduid(ctx_, gpgme_key_t(key), uid.c_str(), 0);
- if (CheckGpgError(err) == GPG_ERR_NO_ERROR)
- return true;
- else
- return false;
+auto GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key,
+ const std::string& uid) -> bool {
+ auto err =
+ gpgme_op_adduid(ctx_, static_cast<gpgme_key_t>(key), uid.c_str(), 0);
+ return CheckGpgError(err) == GPG_ERR_NO_ERROR;
}
-bool GpgFrontend::GpgUIDOperator::RevUID(const GpgFrontend::GpgKey& key,
- const std::string& uid) {
- auto err =
- CheckGpgError(gpgme_op_revuid(ctx_, gpgme_key_t(key), uid.c_str(), 0));
- if (CheckGpgError(err) == GPG_ERR_NO_ERROR)
- return true;
- else
- return false;
+auto GpgFrontend::GpgUIDOperator::RevUID(const GpgFrontend::GpgKey& key,
+ const std::string& uid) -> bool {
+ auto err = CheckGpgError(
+ gpgme_op_revuid(ctx_, static_cast<gpgme_key_t>(key), uid.c_str(), 0));
+ return CheckGpgError(err) == GPG_ERR_NO_ERROR;
}
-bool GpgFrontend::GpgUIDOperator::SetPrimaryUID(const GpgFrontend::GpgKey& key,
- const std::string& uid) {
+auto GpgFrontend::GpgUIDOperator::SetPrimaryUID(const GpgFrontend::GpgKey& key,
+ const std::string& uid)
+ -> bool {
auto err = CheckGpgError(gpgme_op_set_uid_flag(
- ctx_, gpgme_key_t(key), uid.c_str(), "primary", nullptr));
- if (CheckGpgError(err) == GPG_ERR_NO_ERROR)
- return true;
- else
- return false;
+ ctx_, static_cast<gpgme_key_t>(key), uid.c_str(), "primary", nullptr));
+ return CheckGpgError(err) == GPG_ERR_NO_ERROR;
}
-bool GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key,
+auto GpgFrontend::GpgUIDOperator::AddUID(const GpgFrontend::GpgKey& key,
const std::string& name,
const std::string& comment,
- const std::string& email) {
+ const std::string& email) -> bool {
SPDLOG_DEBUG("new uuid: {} {} {}", name, comment, email);
auto uid = boost::format("%1%(%2%)<%3%>") % name % comment % email;
return AddUID(key, uid.str());