diff options
author | saturneric <[email protected]> | 2025-04-19 00:08:03 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-04-19 00:08:03 +0000 |
commit | a6b23476a2c38f2a2809cc4f80b3798a1e5c99a7 (patch) | |
tree | 65c024239a4d2864804bac16133347374947927f /src/core/function/gpg/GpgComponentManager.cpp | |
parent | fix: operations of subkey (diff) | |
download | GpgFrontend-a6b23476a2c38f2a2809cc4f80b3798a1e5c99a7.tar.gz GpgFrontend-a6b23476a2c38f2a2809cc4f80b3798a1e5c99a7.zip |
fix: gpg context will take response of gpg-agent
Diffstat (limited to '')
-rw-r--r-- | src/core/function/gpg/GpgComponentManager.cpp (renamed from src/core/function/gpg/GpgComponentInfoGetter.cpp) | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/core/function/gpg/GpgComponentInfoGetter.cpp b/src/core/function/gpg/GpgComponentManager.cpp index 317f334f..1b302631 100644 --- a/src/core/function/gpg/GpgComponentInfoGetter.cpp +++ b/src/core/function/gpg/GpgComponentManager.cpp @@ -26,14 +26,14 @@ * */ -#include "GpgComponentInfoGetter.h" +#include "GpgComponentManager.h" namespace GpgFrontend { -GpgComponentInfoGetter::GpgComponentInfoGetter(int channel) - : GpgFrontend::SingletonFunctionObject<GpgComponentInfoGetter>(channel) {} +GpgComponentManager::GpgComponentManager(int channel) + : GpgFrontend::SingletonFunctionObject<GpgComponentManager>(channel) {} -auto GpgComponentInfoGetter::GetGpgAgentVersion() -> QString { +auto GpgComponentManager::GetGpgAgentVersion() -> QString { if (!gpg_agent_version_.isEmpty()) return gpg_agent_version_; auto [r, s] = @@ -47,7 +47,7 @@ auto GpgComponentInfoGetter::GetGpgAgentVersion() -> QString { return gpg_agent_version_; } -auto GpgComponentInfoGetter::GetScdaemonVersion() -> QString { +auto GpgComponentManager::GetScdaemonVersion() -> QString { if (!scdaemon_version_.isEmpty()) return scdaemon_version_; auto [r, s] = assuan_.SendDataCommand(GpgComponentType::kGPG_AGENT, @@ -61,4 +61,26 @@ auto GpgComponentInfoGetter::GetScdaemonVersion() -> QString { return scdaemon_version_; } +auto GpgComponentManager::ReloadGpgAgent() -> bool { + auto [r, s] = + assuan_.SendStatusCommand(GpgComponentType::kGPG_AGENT, "RELOADAGENT"); + if (r != GPG_ERR_NO_ERROR) { + LOG_D() << "invalid response of RELOADAGENT: " << s; + return false; + } + + return true; +} + +auto GpgComponentManager::GpgKillAgent() -> bool { + auto [r, s] = + assuan_.SendStatusCommand(GpgComponentType::kGPG_AGENT, "KILLAGENT"); + if (r != GPG_ERR_NO_ERROR) { + LOG_D() << "invalid response of KILLAGENT: " << s; + return false; + } + + return true; +} + } // namespace GpgFrontend
\ No newline at end of file |