aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/GpgConstants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpg/GpgConstants.cpp')
-rw-r--r--src/gpg/GpgConstants.cpp47
1 files changed, 38 insertions, 9 deletions
diff --git a/src/gpg/GpgConstants.cpp b/src/gpg/GpgConstants.cpp
index 2454daa2..fd3c56b4 100644
--- a/src/gpg/GpgConstants.cpp
+++ b/src/gpg/GpgConstants.cpp
@@ -47,9 +47,9 @@ const char* GpgFrontend::GpgConstants::GPG_FRONTEND_SHORT_CRYPTO_HEAD =
gpgme_error_t GpgFrontend::check_gpg_error(gpgme_error_t err) {
if (gpg_err_code(err) != GPG_ERR_NO_ERROR) {
- LOG(ERROR) << "[Error " << gpg_err_code(err)
- << "] Source: " << gpgme_strsource(err)
- << " Description: " << gpgme_strerror(err);
+ LOG(ERROR) << "[" << _("Error") << " " << gpg_err_code(err) << "] "
+ << _("Source: ") << gpgme_strsource(err) << " "
+ << _("Description: ") << gpgme_strerror(err);
}
return err;
}
@@ -58,9 +58,9 @@ gpg_err_code_t GpgFrontend::check_gpg_error_2_err_code(gpgme_error_t err,
gpgme_error_t predict) {
auto err_code = gpg_err_code(err);
if (err_code != predict) {
- LOG(ERROR) << "[Error " << gpg_err_code(err)
- << "] Source: " << gpgme_strsource(err)
- << " Description: " << gpgme_strerror(err);
+ LOG(ERROR) << "[" << _("Error") << " " << gpg_err_code(err) << "] "
+ << _("Source: ") << gpgme_strsource(err) << " "
+ << _("Description: ") << gpgme_strerror(err);
}
return err_code;
}
@@ -69,9 +69,9 @@ gpg_err_code_t GpgFrontend::check_gpg_error_2_err_code(gpgme_error_t err,
gpgme_error_t GpgFrontend::check_gpg_error(gpgme_error_t err,
const std::string& comment) {
if (gpg_err_code(err) != GPG_ERR_NO_ERROR) {
- LOG(ERROR) << "[Error " << gpg_err_code(err)
- << "] Source: " << gpgme_strsource(err)
- << " Description: " << gpgme_strerror(err) << " " << comment;
+ LOG(ERROR) << "[" << _("Error") << " " << gpg_err_code(err) << "] "
+ << _("Source: ") << gpgme_strsource(err) << " "
+ << _("Description: ") << gpgme_strerror(err);
}
return err;
}
@@ -190,3 +190,32 @@ int GpgFrontend::text_is_signed(GpgFrontend::BypeArrayRef text) {
else
return 0;
}
+
+GpgFrontend::GpgEncrResult GpgFrontend::_new_result(
+ gpgme_encrypt_result_t&& result) {
+ gpgme_result_ref(result);
+ return {result, _result_ref_deletor()};
+}
+
+GpgFrontend::GpgDecrResult GpgFrontend::_new_result(
+ gpgme_decrypt_result_t&& result) {
+ gpgme_result_ref(result);
+ return {result, _result_ref_deletor()};
+}
+
+GpgFrontend::GpgSignResult GpgFrontend::_new_result(
+ gpgme_sign_result_t&& result) {
+ gpgme_result_ref(result);
+ return {result, _result_ref_deletor()};
+}
+
+GpgFrontend::GpgVerifyResult GpgFrontend::_new_result(
+ gpgme_verify_result_t&& result) {
+ gpgme_result_ref(result);
+ return {result, _result_ref_deletor()};
+}
+
+void GpgFrontend::_result_ref_deletor::operator()(void* _result) {
+ DLOG(INFO) << _("Called") << _result;
+ if (_result != nullptr) gpgme_result_unref(_result);
+}