[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 06/08: fix
From: |
gnunet |
Subject: |
[taler-anastasis] 06/08: fix |
Date: |
Fri, 09 Oct 2020 12:03:47 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit bed5c82146891df18401728335d314301e473f9b
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Thu Oct 8 15:47:54 2020 +0200
fix
---
src/include/anastasis_redux.h | 15 ++++--------
src/lib/anastasis_api_backup_redux.c | 10 ++++----
src/lib/anastasis_api_recovery_redux.c | 10 ++++----
src/lib/anastasis_api_redux.c | 44 ++++++++++++++++++++++++----------
4 files changed, 44 insertions(+), 35 deletions(-)
diff --git a/src/include/anastasis_redux.h b/src/include/anastasis_redux.h
index c75ca2a..76c8f57 100644
--- a/src/include/anastasis_redux.h
+++ b/src/include/anastasis_redux.h
@@ -28,20 +28,15 @@
#include "anastasis_error_codes.h"
-/**
- * JSON containing all supported countries and additional data.
- */
-extern json_t *redux_countries;
-
/**
* JSON containing country specific identity attributes to ask the user for.
*/
-extern json_t *redux_id_attr;
+extern const json_t *redux_id_attr;
/**
* JSON containing anastasis providers.
*/
-extern json_t *provider_list;
+extern const json_t *provider_list;
/**
* Currency of chosen country
@@ -77,11 +72,11 @@ ANASTASIS_recovery_start (const struct
GNUNET_CONFIGURATION_Handle *cfg);
/**
* Function to load json containing all countries.
- * Returns #GNUNET_OK if operation succeeded, else #GNUNET_SYSERR.
+ * Returns the countries.
*
- * @return int
+ * @return json_t *
*/
-int
+json_t *
redux_countries_init ();
diff --git a/src/lib/anastasis_api_backup_redux.c
b/src/lib/anastasis_api_backup_redux.c
index bfcce2b..f2f18b8 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -65,15 +65,13 @@ ANASTASIS_backup_start (const struct
GNUNET_CONFIGURATION_Handle *cfg)
json_t *initial_state;
json_t *temp_country;
size_t index;
- json_t *continents = json_array ();
json_t *root;
+ json_t *continents = json_array ();
+ json_t *redux_countries = redux_countries_init ();
- if (GNUNET_SYSERR == redux_countries_init ())
- {
- GNUNET_break (0);
- return NULL;
- }
+ GNUNET_assert (NULL != redux_countries);
root = json_object_get (redux_countries, "countries");
+ GNUNET_assert (NULL != root);
json_array_foreach (root, index, temp_country)
{
diff --git a/src/lib/anastasis_api_recovery_redux.c
b/src/lib/anastasis_api_recovery_redux.c
index d76d78d..50cfa28 100644
--- a/src/lib/anastasis_api_recovery_redux.c
+++ b/src/lib/anastasis_api_recovery_redux.c
@@ -63,15 +63,13 @@ ANASTASIS_recovery_start (const struct
GNUNET_CONFIGURATION_Handle *cfg)
json_t *initial_state;
json_t *temp_country;
size_t index;
- json_t *continents = json_array ();
json_t *root;
+ json_t *continents = json_array ();
+ json_t *redux_countries = redux_countries_init ();
- if (GNUNET_SYSERR == redux_countries_init ())
- {
- GNUNET_break (0);
- return NULL;
- }
+ GNUNET_assert (NULL != redux_countries);
root = json_object_get (redux_countries, "countries");
+ GNUNET_assert (NULL != root);
json_array_foreach (root, index, temp_country)
{
diff --git a/src/lib/anastasis_api_redux.c b/src/lib/anastasis_api_redux.c
index 294db39..6ae7363 100644
--- a/src/lib/anastasis_api_redux.c
+++ b/src/lib/anastasis_api_redux.c
@@ -26,20 +26,16 @@
#include "anastasis_redux.h"
#include "anastasis_error_codes.h"
-/**
- * JSON containing all supported countries and additional data.
- */
-json_t *redux_countries;
/**
* JSON containing country specific identity attributes to ask the user for.
*/
-json_t *redux_id_attr;
+const json_t *redux_id_attr;
/**
* JSON containing anastasis providers.
*/
-json_t *provider_list;
+const json_t *provider_list;
/**
* Currency of chosen country
@@ -82,15 +78,16 @@ char *get_state_mode (const json_t *state)
/**
* Function to load json containing all countries.
- * Returns #GNUNET_OK if operation succeeded, else #GNUNET_SYSERR.
+ * Returns the countries.
*
- * @return int
+ * @return json_t *
*/
-int
+json_t *
redux_countries_init ()
{
char *dn;
json_error_t error;
+ json_t *redux_countries;
{
char *path;
@@ -99,7 +96,7 @@ redux_countries_init ()
if (NULL == path)
{
GNUNET_break (0);
- return GNUNET_SYSERR;
+ return NULL;
}
GNUNET_asprintf (&dn,
"%s/share/anastasis/redux.countries.json",
@@ -117,10 +114,10 @@ redux_countries_init ()
error.column,
error.position);
GNUNET_free (dn);
- return GNUNET_SYSERR;
+ return NULL;
}
GNUNET_free (dn);
- return GNUNET_OK;
+ return redux_countries;
}
@@ -179,6 +176,7 @@ select_continent (json_t *state,
{
size_t index;
json_t *country;
+ json_t *redux_countries = redux_countries_init ();
json_t *root = json_object_get (redux_countries, "countries");
json_t *countries = json_array ();
json_t *continent = json_object_get (arguments, "continent");
@@ -396,6 +394,11 @@ ANASTASIS_redux_action (const json_t *state,
"unselect_continent",
&unselect_continent
},
+ {
+ "CountrySelectionState",
+ "select_continent",
+ &select_continent
+ },
{
"CountrySelectionState",
"select_country",
@@ -403,7 +406,7 @@ ANASTASIS_redux_action (const json_t *state,
},
{
"UserAttributesCollectionState",
- "back",
+ "unselect_country",
&unselect_country
},
{
@@ -411,16 +414,31 @@ ANASTASIS_redux_action (const json_t *state,
"select_country",
&select_country
},
+ {
+ "UserAttributesCollectionState",
+ "back",
+ &unselect_country
+ },
{
"UserAttributesCollectionState",
"select_continent",
&select_continent
},
+ {
+ "UserAttributesCollectionState",
+ "unselect_continent",
+ &unselect_continent
+ },
{
"UserAttributesCollectionState",
"enter_user_attributes",
&enter_user_attributes
},
+ {
+ "AuthenticationsEditingState",
+ "back",
+ &enter_user_attributes
+ },
{ NULL, NULL, NULL }
};
json_t *new_state;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (f4aa746 -> 1586ccd), gnunet, 2020/10/09
- [taler-anastasis] 04/08: fix, gnunet, 2020/10/09
- [taler-anastasis] 02/08: fixes, gnunet, 2020/10/09
- [taler-anastasis] 03/08: fix, gnunet, 2020/10/09
- [taler-anastasis] 06/08: fix,
gnunet <=
- [taler-anastasis] 01/08: fixes, gnunet, 2020/10/09
- [taler-anastasis] 05/08: fix changing continent, gnunet, 2020/10/09
- [taler-anastasis] 07/08: enumerate states, gnunet, 2020/10/09
- [taler-anastasis] 08/08: rework add_authentication, gnunet, 2020/10/09