gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] 01/03: fix reducer state enums


From: gnunet
Subject: [taler-anastasis] 01/03: fix reducer state enums
Date: Thu, 29 Oct 2020 20:52:12 +0100

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a commit to branch master
in repository anastasis.

commit 69bc40735917a761503f238e7a2acaddb3db37da
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Tue Oct 27 11:57:41 2020 +0100

    fix reducer state enums
---
 src/backend/anastasis-httpd_policy_upload.c       | 24 +-----------
 src/backend/anastasis-httpd_truth.c               |  6 +--
 src/backend/anastasis_authorization_plugin_file.c |  1 +
 src/include/anastasis_redux.h                     | 18 +++++----
 src/lib/anastasis.c                               |  2 -
 src/lib/anastasis_api_backup_redux.c              |  2 +-
 src/lib/anastasis_api_config.c                    |  2 -
 src/lib/anastasis_api_recovery_redux.c            |  2 +-
 src/lib/anastasis_api_redux.c                     | 45 +++++------------------
 9 files changed, 26 insertions(+), 76 deletions(-)

diff --git a/src/backend/anastasis-httpd_policy_upload.c 
b/src/backend/anastasis-httpd_policy_upload.c
index 701376a..bddc811 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -404,10 +404,6 @@ ongoing_payment_cb (void *cls,
 static void
 check_payment_cb (void *cls,
                   const struct TALER_MERCHANT_HttpResponse *hr,
-                  // int paid, FIXME: DELETE
-                  // int refunded, FIXME: DELETE
-                  // struct TALER_Amount *refund_amount, FIXME: DELETE
-                  // const char *taler_pay_uri) FIXME: DELETE
                   const struct TALER_MERCHANT_OrderStatusResponse *osr)
 
 {
@@ -424,11 +420,7 @@ check_payment_cb (void *cls,
   MHD_resume_connection (puc->con);
   AH_trigger_daemon ();
 
-  /**
-   * FIXME: DELETE
-  GNUNET_break ( (GNUNET_NO == refunded) &&
-                 (NULL == refund_amount) );
-  */if (osr->status)
+  if (osr->status)
   {
     enum ANASTASIS_DB_QueryStatus qs;
 
@@ -984,19 +976,7 @@ AH_handler_policy_post (struct MHD_Connection *connection,
         MHD_destroy_response (resp);
         return ret;
       }
-      /**
-       * FIXME: useful?
-      if (0 != GNUNET_memcmp (&hc,
-                              &puc->old_policy_upload_hash))
-      {
-        // Refuse upload: if-none-match failed!
-        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                    "Conflict detected, returning existing recovery 
document\n");
-        return AH_return_policy (connection,
-                                 &accountPubP,
-                                 MHD_HTTP_CONFLICT);
-      }
-      */}
+    }
     /* check if the client insists on paying */
     {
       const char *order_req;
diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 01892ce..49a8a8c 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -369,11 +369,7 @@ check_payment_cb (void *cls,
   MHD_resume_connection (gc->connection);
   AH_trigger_daemon ();
 
-  /**
-   * FIXME: DELETE
-  GNUNET_break ( (GNUNET_NO == refunded) &&
-                 (NULL == refund_amount) );
-  */if (osr->status)
+  if (osr->status)
   {
     enum ANASTASIS_DB_QueryStatus qs;
 
diff --git a/src/backend/anastasis_authorization_plugin_file.c 
b/src/backend/anastasis_authorization_plugin_file.c
index ecc0dbe..75a6f12 100644
--- a/src/backend/anastasis_authorization_plugin_file.c
+++ b/src/backend/anastasis_authorization_plugin_file.c
@@ -142,6 +142,7 @@ file_process (struct ANASTASIS_AUTHORIZATION_State *as,
               struct MHD_Connection *connection)
 {
   MHD_RESULT mres;
+  // FIXME: initialize and rename foobar correctly!!!
   struct MHD_Response *foobar;
   FILE *f = fopen (as->data, "w");
 
diff --git a/src/include/anastasis_redux.h b/src/include/anastasis_redux.h
index c2557d9..7eeada0 100644
--- a/src/include/anastasis_redux.h
+++ b/src/include/anastasis_redux.h
@@ -30,9 +30,9 @@
 
 #define ANASTASIS_GENERIC_STATES(REDUX_STATE) \
   REDUX_STATE (ERROR) \
-  REDUX_STATE (CONTINENT_SELECTION)   \
-  REDUX_STATE (COUNTRY_SELECTION)  \
-  REDUX_STATE (USER_ATTRIBUTES_COLLECTION)
+  REDUX_STATE (CONTINENT_SELECTING)   \
+  REDUX_STATE (COUNTRY_SELECTING)  \
+  REDUX_STATE (USER_ATTRIBUTES_COLLECTING)
 
 #define GENERATE_GENERIC_ENUM(ENUM) ANASTASIS_GENERIC_STATE_ ## ENUM,
 
@@ -47,7 +47,9 @@ enum ANASTASIS_GenericState
   ANASTASIS_GENERIC_STATES (REDUX_STATE) \
   REDUX_STATE (AUTHENTICATIONS_EDITING)  \
   REDUX_STATE (POLICIES_REVIEWING)   \
-  REDUX_STATE (PAYING)
+  REDUX_STATE (SECRET_EDITING) \
+  REDUX_STATE (POLICIES_PAYING) \
+  REDUX_STATE (FINISHED)
 
 #define GENERATE_BACKUP_ENUM(ENUM) ANASTASIS_BACKUP_STATE_ ## ENUM,
 
@@ -60,10 +62,10 @@ enum ANASTASIS_BackupState
 
 #define ANASTASIS_RECOVERY_STATES(REDUX_STATE) \
   ANASTASIS_GENERIC_STATES (REDUX_STATE) \
-  REDUX_STATE (AuthenticationsEditingState)  \
-  REDUX_STATE (PoliciesReviewingState)   \
-  REDUX_STATE (BackupPayingState)  \
-  REDUX_STATE (NoState) \
+  REDUX_STATE (CHALLENGE_SELECTING)  \
+  REDUX_STATE (CHALLENGE_PAYING)   \
+  REDUX_STATE (CHALLENGE_SOLVING)  \
+  REDUX_STATE (FINISHED)
 
 #define GENERATE_RECOVERY_ENUM(ENUM) ANASTASIS_RECOVERY_STATE_ ## ENUM,
 
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 6285818..8528d60 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -1953,8 +1953,6 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
                                               ss->pss[l]);
     GNUNET_assert (NULL != ss->pss[l]->pso);
   }
-  // FIXME: clean up PSS, TRUTHS etc. !!!
-  // SETUP SHARE RESULT CALLBACK
   return ss;
 }
 
diff --git a/src/lib/anastasis_api_backup_redux.c 
b/src/lib/anastasis_api_backup_redux.c
index 5d0e55d..b380009 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -144,7 +144,7 @@ ANASTASIS_backup_start (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
   initial_state = json_pack ("{s:s, s:o}",
                              "backup_state",
                              ANASTASIS_generic_state_to_string (
-                               ANASTASIS_BACKUP_STATE_CONTINENT_SELECTION),
+                               ANASTASIS_BACKUP_STATE_CONTINENT_SELECTING),
                              "continents",
                              continents);
   GNUNET_assert (NULL != initial_state);
diff --git a/src/lib/anastasis_api_config.c b/src/lib/anastasis_api_config.c
index dcc4fb9..a1b5e6a 100644
--- a/src/lib/anastasis_api_config.c
+++ b/src/lib/anastasis_api_config.c
@@ -73,8 +73,6 @@ struct ANASTASIS_ConfigOperation
    * Currency of the cost;
    */
   const char *currency;
-
-  // FIXME add configs
 };
 
 
diff --git a/src/lib/anastasis_api_recovery_redux.c 
b/src/lib/anastasis_api_recovery_redux.c
index 143ef2b..f9c2649 100644
--- a/src/lib/anastasis_api_recovery_redux.c
+++ b/src/lib/anastasis_api_recovery_redux.c
@@ -131,7 +131,7 @@ ANASTASIS_recovery_start (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
   initial_state = json_pack ("{s:s, s:o}",
                              "recovery_state",
                              ANASTASIS_recovery_state_to_string (
-                               ANASTASIS_RECOVERY_STATE_CONTINENT_SELECTION),
+                               ANASTASIS_RECOVERY_STATE_CONTINENT_SELECTING),
                              "continents",
                              continents);
   return initial_state;
diff --git a/src/lib/anastasis_api_redux.c b/src/lib/anastasis_api_redux.c
index 09f2329..3561082 100644
--- a/src/lib/anastasis_api_redux.c
+++ b/src/lib/anastasis_api_redux.c
@@ -497,7 +497,7 @@ select_continent (json_t *state,
                    s_mode,
                    json_string (
                      ANASTASIS_backup_state_to_string (
-                       ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION))));
+                       ANASTASIS_GENERIC_STATE_COUNTRY_SELECTING))));
 
   GNUNET_assert (0 ==
                  json_object_set_new (state,
@@ -549,7 +549,7 @@ select_country (json_t *state,
                    s_mode,
                    json_string (
                      ANASTASIS_generic_state_to_string (
-                       ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION))));
+                       ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTING))));
   GNUNET_assert (0 ==
                  json_object_set_new (state,
                                       "selected_country",
@@ -666,7 +666,7 @@ unselect_country (json_t *state,
                    s_mode,
                    json_string (
                      ANASTASIS_generic_state_to_string (
-                       ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION))));
+                       ANASTASIS_GENERIC_STATE_COUNTRY_SELECTING))));
   cb (cb_cls,
       ANASTASIS_EC_NONE,
       state);
@@ -690,7 +690,7 @@ unselect_continent (json_t *state,
                    s_mode,
                    json_string (
                      ANASTASIS_generic_state_to_string (
-                       ANASTASIS_GENERIC_STATE_CONTINENT_SELECTION))));
+                       ANASTASIS_GENERIC_STATE_CONTINENT_SELECTING))));
   cb (cb_cls,
       ANASTASIS_EC_NONE,
       state);
@@ -796,57 +796,32 @@ ANASTASIS_redux_action (const json_t *state,
     DispatchHandler fun;
   } dispatchers[] = {
     {
-      ANASTASIS_GENERIC_STATE_CONTINENT_SELECTION,
+      ANASTASIS_GENERIC_STATE_CONTINENT_SELECTING,
       "select_continent",
       &select_continent
     },
     {
-      ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION,
+      ANASTASIS_GENERIC_STATE_COUNTRY_SELECTING,
       "unselect_continent",
       &unselect_continent
     },
     {
-      ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION,
+      ANASTASIS_GENERIC_STATE_COUNTRY_SELECTING,
       "select_continent",
       &select_continent
     },
     {
-      ANASTASIS_GENERIC_STATE_COUNTRY_SELECTION,
+      ANASTASIS_GENERIC_STATE_COUNTRY_SELECTING,
       "select_country",
       &select_country
     },
     {
-      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION,
-      "unselect_country",
-      &unselect_country
-    },
-    {
-      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION,
-      "select_country",
-      &select_country
-    },
-    {
-      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION,
-      "back",
-      &unselect_country
-    },
-    {
-      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION,
-      "select_continent",
-      &select_continent
-    },
-    {
-      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION,
-      "unselect_continent",
-      &unselect_continent
-    },
-    {
-      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION,
+      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTING,
       "enter_user_attributes",
       &enter_user_attributes
     },
     {
-      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTION,
+      ANASTASIS_GENERIC_STATE_USER_ATTRIBUTES_COLLECTING,
       "back",
       &ANASTASIS_back_generic_decrement_
     },

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]