aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2022-12-08 14:20:14 +0000
committerIngo Klöcker <[email protected]>2022-12-08 14:31:21 +0000
commitc419376b85ff4a489f3bf7ad97ed656495792523 (patch)
tree1d0f0bd460a4861488c499306b926fbbd2db1779
parentqt: Write path values with Unix directory separators (diff)
downloadgpgme-c419376b85ff4a489f3bf7ad97ed656495792523.tar.gz
gpgme-c419376b85ff4a489f3bf7ad97ed656495792523.zip
cpp: Handle statuses that need no response in the base edit interactor
* lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl): Do not call nextState() if status needs no response. * lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp (GpgAddExistingSubkeyEditInteractor::Private::nextState), lang/cpp/src/gpgadduserideditinteractor.cpp (GpgAddUserIDEditInteractor::nextState), lang/cpp/src/gpggencardkeyinteractor.cpp (GpgGenCardKeyInteractor::nextState), lang/cpp/src/gpgrevokekeyeditinteractor.cpp (GpgRevokeKeyEditInteractor::Private::nextState), lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp (GpgSetExpiryTimeEditInteractor::nextState), lang/cpp/src/gpgsetownertrusteditinteractor.cpp (GpgSetOwnerTrustEditInteractor::nextState), lang/cpp/src/gpgsignkeyeditinteractor.cpp (GpgSignKeyEditInteractor::nextState): Remove handling of statuses that need no response. -- This change removes superfluous code duplication. GnuPG-bug-id: 6305
-rw-r--r--lang/cpp/src/editinteractor.cpp8
-rw-r--r--lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgadduserideditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpggencardkeyinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgrevokekeyeditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgsetownertrusteditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgsignkeyeditinteractor.cpp3
8 files changed, 7 insertions, 28 deletions
diff --git a/lang/cpp/src/editinteractor.cpp b/lang/cpp/src/editinteractor.cpp
index 08cb1bc9..707bf8b9 100644
--- a/lang/cpp/src/editinteractor.cpp
+++ b/lang/cpp/src/editinteractor.cpp
@@ -96,7 +96,13 @@ public:
// advance to next state based on input:
const unsigned int oldState = ei->state;
- ei->state = ei->q->nextState(status, args, err);
+
+ if (ei->q->needsNoResponse(status)) {
+ // keep state
+ } else {
+ ei->state = ei->q->nextState(status, args, err);
+ }
+
if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: %u -> nextState( %s, %s ) -> %u\n",
oldState, status_to_string(status), args ? args : "<null>", ei->state);
diff --git a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
index 8eec7460..49e98def 100644
--- a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
+++ b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
@@ -105,10 +105,6 @@ unsigned int GpgAddExistingSubkeyEditInteractor::Private::nextState(unsigned int
static const Error NO_KEY_ERROR = Error::fromCode(GPG_ERR_NO_KEY);
static const Error INV_TIME_ERROR = Error::fromCode(GPG_ERR_INV_TIME);
- if (q->needsNoResponse(status)) {
- return q->state();
- }
-
switch (q->state()) {
case START:
if (status == GPGME_STATUS_GET_LINE &&
diff --git a/lang/cpp/src/gpgadduserideditinteractor.cpp b/lang/cpp/src/gpgadduserideditinteractor.cpp
index c26f5593..1f27c84f 100644
--- a/lang/cpp/src/gpgadduserideditinteractor.cpp
+++ b/lang/cpp/src/gpgadduserideditinteractor.cpp
@@ -120,10 +120,6 @@ unsigned int GpgAddUserIDEditInteractor::nextState(unsigned int status, const ch
static const Error INV_EMAIL_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
static const Error INV_COMMENT_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
- if (needsNoResponse(status)) {
- return state();
- }
-
using namespace GpgAddUserIDEditInteractor_Private;
switch (state()) {
diff --git a/lang/cpp/src/gpggencardkeyinteractor.cpp b/lang/cpp/src/gpggencardkeyinteractor.cpp
index a28169ec..cd226c27 100644
--- a/lang/cpp/src/gpggencardkeyinteractor.cpp
+++ b/lang/cpp/src/gpggencardkeyinteractor.cpp
@@ -192,10 +192,6 @@ unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char
static const Error INV_EMAIL_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
static const Error INV_COMMENT_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
- if (needsNoResponse(status)) {
- return state();
- }
-
using namespace GpgGenCardKeyInteractor_Private;
switch (state()) {
diff --git a/lang/cpp/src/gpgrevokekeyeditinteractor.cpp b/lang/cpp/src/gpgrevokekeyeditinteractor.cpp
index 86b3c3c4..fd584099 100644
--- a/lang/cpp/src/gpgrevokekeyeditinteractor.cpp
+++ b/lang/cpp/src/gpgrevokekeyeditinteractor.cpp
@@ -112,10 +112,6 @@ unsigned int GpgRevokeKeyEditInteractor::Private::nextState(unsigned int status,
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
- if (q->needsNoResponse(status)) {
- return q->state();
- }
-
if (status == GPGME_STATUS_ERROR) {
err = q->parseStatusError(args);
return ERROR;
diff --git a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp b/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
index 2936d194..2409ef19 100644
--- a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
+++ b/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
@@ -94,10 +94,6 @@ unsigned int GpgSetExpiryTimeEditInteractor::nextState(unsigned int status, cons
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
static const Error INV_TIME_ERROR = Error::fromCode(GPG_ERR_INV_TIME);
- if (needsNoResponse(status)) {
- return state();
- }
-
using namespace GpgSetExpiryTimeEditInteractor_Private;
switch (state()) {
diff --git a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp b/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
index f1e99ea9..e28951ba 100644
--- a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
+++ b/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
@@ -98,10 +98,6 @@ unsigned int GpgSetOwnerTrustEditInteractor::nextState(unsigned int status, cons
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
//static const Error INV_TIME_ERROR = Error::fromCode( GPG_ERR_INV_TIME );
- if (needsNoResponse(status)) {
- return state();
- }
-
using namespace GpgSetOwnerTrustEditInteractor_Private;
switch (state()) {
diff --git a/lang/cpp/src/gpgsignkeyeditinteractor.cpp b/lang/cpp/src/gpgsignkeyeditinteractor.cpp
index 1c8af148..164cfc03 100644
--- a/lang/cpp/src/gpgsignkeyeditinteractor.cpp
+++ b/lang/cpp/src/gpgsignkeyeditinteractor.cpp
@@ -304,9 +304,6 @@ unsigned int GpgSignKeyEditInteractor::nextState(unsigned int status, const char
static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
//static const Error INV_TIME_ERROR = Error::fromCode( GPG_ERR_INV_TIME );
static const TransitionMap table(makeTable());
- if (needsNoResponse(status)) {
- return state();
- }
using namespace GpgSignKeyEditInteractor_Private;