aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function/UidOperator.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-10-02 14:08:50 +0000
committerSaturneric <[email protected]>2021-10-02 14:16:27 +0000
commit3c65d087eeee687ac01af2e80f3dd538f9a2c230 (patch)
tree1e860dc6343c1897e2224a002f2ca44c574381b3 /src/gpg/function/UidOperator.cpp
parentThe basic functions of the core pass the test. (diff)
downloadGpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.tar.gz
GpgFrontend-3c65d087eeee687ac01af2e80f3dd538f9a2c230.zip
UI Framework Modified.
Diffstat (limited to 'src/gpg/function/UidOperator.cpp')
-rw-r--r--src/gpg/function/UidOperator.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/gpg/function/UidOperator.cpp b/src/gpg/function/UidOperator.cpp
index d0058540..5b02855b 100644
--- a/src/gpg/function/UidOperator.cpp
+++ b/src/gpg/function/UidOperator.cpp
@@ -26,34 +26,38 @@
#include "boost/format.hpp"
-bool GpgFrontend::UidOperator::addUID(const GpgFrontend::GpgKey &key,
- const GpgFrontend::GpgUID &uid) {
- auto userid = (boost::format("%1% (%2%) <%3%>") % uid.name() % uid.comment() %
- uid.email())
- .str();
- auto err = gpgme_op_adduid(ctx, gpgme_key_t(key), userid.c_str(), 0);
+bool GpgFrontend::UidOperator::addUID(const GpgFrontend::GpgKey& key,
+ 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;
else
return false;
}
-bool GpgFrontend::UidOperator::revUID(const GpgFrontend::GpgKey &key,
- const GpgFrontend::GpgUID &uid) {
- auto err = check_gpg_error(
- gpgme_op_revuid(ctx, gpgme_key_t(key), uid.uid().c_str(), 0));
+bool GpgFrontend::UidOperator::revUID(const GpgFrontend::GpgKey& key,
+ 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)
return true;
else
return false;
}
-bool GpgFrontend::UidOperator::setPrimaryUID(const GpgFrontend::GpgKey &key,
- const GpgFrontend::GpgUID &uid) {
+bool GpgFrontend::UidOperator::setPrimaryUID(const GpgFrontend::GpgKey& key,
+ const std::string& uid) {
auto err = check_gpg_error(gpgme_op_set_uid_flag(
- ctx, gpgme_key_t(key), uid.uid().c_str(), "primary", nullptr));
+ ctx, gpgme_key_t(key), uid.c_str(), "primary", nullptr));
if (check_gpg_error_2_err_code(err) == GPG_ERR_NO_ERROR)
return true;
else
return false;
}
+bool GpgFrontend::UidOperator::addUID(const GpgFrontend::GpgKey& key,
+ const std::string& name,
+ const std::string& comment,
+ const std::string& email) {
+ auto uid = boost::format("%1 (%2) <%3>") % name % comment % email;
+ return addUID(key, uid.str());
+}