aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/gpg/GpgAssuanHelper.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-04-17 17:44:04 +0000
committersaturneric <[email protected]>2025-04-17 17:44:04 +0000
commit6f504e4f915f928e42b8574ca3f93eea5038984b (patch)
treed5542b5cfad3d597038f7621e9975447efd7d9e6 /src/core/function/gpg/GpgAssuanHelper.cpp
parentchore: update and check translations (diff)
downloadGpgFrontend-6f504e4f915f928e42b8574ca3f93eea5038984b.tar.gz
GpgFrontend-6f504e4f915f928e42b8574ca3f93eea5038984b.zip
feat: check scd version
Diffstat (limited to 'src/core/function/gpg/GpgAssuanHelper.cpp')
-rw-r--r--src/core/function/gpg/GpgAssuanHelper.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/function/gpg/GpgAssuanHelper.cpp b/src/core/function/gpg/GpgAssuanHelper.cpp
index 2fa836e5..0d1b9cdc 100644
--- a/src/core/function/gpg/GpgAssuanHelper.cpp
+++ b/src/core/function/gpg/GpgAssuanHelper.cpp
@@ -161,6 +161,40 @@ auto GpgAssuanHelper::SendStatusCommand(GpgComponentType type,
return {ret, status_lines};
}
+auto GpgAssuanHelper::SendDataCommand(GpgComponentType type,
+ const QString& command)
+ -> std::tuple<bool, QStringList> {
+ QStringList data_lines;
+ GpgAssuanHelper::DataCallback d_cb =
+ [&](const QSharedPointer<GpgAssuanHelper::AssuanCallbackContext>& ctx)
+ -> gpg_error_t {
+ LOG_D() << "data callback of command " << command << ": " << ctx->buffer;
+ data_lines.push_back(QString::fromUtf8(ctx->buffer));
+ return 0;
+ };
+
+ GpgAssuanHelper::InqueryCallback i_cb =
+ [=](const QSharedPointer<GpgAssuanHelper::AssuanCallbackContext>& ctx)
+ -> gpg_error_t {
+ LOG_D() << "inquery callback of command: " << command << ": "
+ << ctx->inquery;
+
+ return 0;
+ };
+
+ GpgAssuanHelper::StatusCallback s_cb =
+ [&](const QSharedPointer<GpgAssuanHelper::AssuanCallbackContext>& ctx)
+ -> gpg_error_t {
+ LOG_D() << "status callback of command: " << command << ": "
+ << ctx->status;
+
+ return 0;
+ };
+
+ auto ret = SendCommand(type, command, d_cb, i_cb, s_cb);
+ return {ret, data_lines};
+}
+
auto GpgAssuanHelper::default_data_callback(void* opaque, const void* buffer,
size_t length) -> gpgme_error_t {
auto ctx = *static_cast<QSharedPointer<AssuanCallbackContext>*>(opaque);