aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function/GpgKeyGetter.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-09-05 21:41:00 +0000
committerSaturneric <[email protected]>2021-09-05 21:41:00 +0000
commite2d30cc0194db74b77e3c06dbaf9c597bb82c860 (patch)
treed9df5302e59c59135495ee81657422cebd7b6092 /src/gpg/function/GpgKeyGetter.cpp
parentRewrite the core. (diff)
downloadGpgFrontend-e2d30cc0194db74b77e3c06dbaf9c597bb82c860.tar.gz
GpgFrontend-e2d30cc0194db74b77e3c06dbaf9c597bb82c860.zip
Adjust the code structure.
Introduce log library. Remove Qt from the core code.
Diffstat (limited to 'src/gpg/function/GpgKeyGetter.cpp')
-rw-r--r--src/gpg/function/GpgKeyGetter.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gpg/function/GpgKeyGetter.cpp b/src/gpg/function/GpgKeyGetter.cpp
index 4bea83f3..f8e361bd 100644
--- a/src/gpg/function/GpgKeyGetter.cpp
+++ b/src/gpg/function/GpgKeyGetter.cpp
@@ -24,14 +24,16 @@
#include "gpg/function/GpgKeyGetter.h"
-GpgFrontend::GpgKey &&
-GpgFrontend::GpgKeyGetter::GetKey(const std::string &fpr) {
+GpgFrontend::GpgKey GpgFrontend::GpgKeyGetter::GetKey(const std::string &fpr) {
+ LOG(INFO) << "GpgKeyGetter GetKey Fpr " << fpr;
gpgme_key_t _p_key;
gpgme_get_key(ctx, fpr.c_str(), &_p_key, 1);
+ if (_p_key == nullptr)
+ LOG(WARNING) << "GpgKeyGetter GetKey _p_key Null";
return std::move(GpgKey(std::move(_p_key)));
}
-GpgFrontend::GpgKey &&
+GpgFrontend::GpgKey
GpgFrontend::GpgKeyGetter::GetPubkey(const std::string &fpr) {
gpgme_key_t _p_key;
gpgme_get_key(ctx, fpr.c_str(), &_p_key, 0);
@@ -42,28 +44,28 @@ GpgFrontend::KeyListPtr GpgFrontend::GpgKeyGetter::FetchKey() {
gpgme_error_t err;
- qDebug() << "Clear List and Map";
+ LOG(INFO) << "Clear List and Map";
KeyListPtr keys_list = std::make_unique<std::vector<GpgKey>>();
- qDebug() << "Operate KeyList Start";
+ LOG(INFO) << "Operate KeyList Start";
err = gpgme_op_keylist_start(ctx, nullptr, 0);
assert(gpg_err_code(err) != GPG_ERR_NO_ERROR);
- qDebug() << "Start Loop";
+ LOG(INFO) << "Start Loop";
gpgme_key_t key;
while ((err = gpgme_op_keylist_next(ctx, &key)) == GPG_ERR_NO_ERROR) {
keys_list->push_back(GpgKey(std::move(key)));
- qDebug() << "Append Key" << keys_list->back().id().c_str();
+ LOG(INFO) << "Append Key" << keys_list->back().id().c_str();
}
assert(gpg_err_code(err) != GPG_ERR_NO_ERROR);
err = gpgme_op_keylist_end(ctx);
- qDebug() << "Operate KeyList End";
+ LOG(INFO) << "Operate KeyList End";
return keys_list;
}