gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 01/03: fixed config api


From: gnunet
Subject: [taler-anastasis] 01/03: fixed config api
Date: Wed, 20 May 2020 23:51:48 +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 096d7fa5231cc5d84cf46188cc8389b6011edda5
Author: Dennis Neufeld <address@hidden>
AuthorDate: Tue May 19 17:41:35 2020 +0000

    fixed config api
---
 src/cli/anastasis-cli-splitter.c | 37 ++++++++++++++++++++++---------------
 src/lib/anastasis_api_config.c   |  3 ++-
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/src/cli/anastasis-cli-splitter.c b/src/cli/anastasis-cli-splitter.c
index 39301d3..df3277c 100644
--- a/src/cli/anastasis-cli-splitter.c
+++ b/src/cli/anastasis-cli-splitter.c
@@ -239,6 +239,10 @@ static struct TruthUploadState *tu_states;
 static unsigned int tu_states_length = 0;
 
 
+static void
+start_read_keyboard (void);
+
+
 /**
  * Function called with the results of a #ANASTASIS_get_config().
  *
@@ -256,6 +260,9 @@ config_cb (void *cls,
   struct ConfigState *cs = cls;
 
   cs->co = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "At %s:%d url is %s\n", __FILE__, __LINE__,
+              cs->tus->backend_url);
   if (http_status != cs->http_status)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -295,6 +302,8 @@ config_cb (void *cls,
   GNUNET_array_append (tu_states,
                        tu_states_length,
                        *cs->tus);
+  keyboard_task = NULL;
+  start_read_keyboard ();
 }
 
 
@@ -314,6 +323,9 @@ salt_cb (void *cls,
   struct ConfigState *cs = GNUNET_new (struct ConfigState);
 
   ss->so = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "At %s:%d url is %s\n", __FILE__, __LINE__,
+              ss->tus->backend_url);
   if (http_status != ss->http_status)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -334,11 +346,6 @@ salt_cb (void *cls,
                                  cs->tus->backend_url,
                                  config_cb,
                                  cs);
-  // FIXME: DELETE THIS, WHEN ABOVE IS FIXED_
-  // cs->methods = "question"; // FIXME
-  // TALER_string_to_amount ("EUR:3.99",
-  //                        &cs->cost);
-
   if (NULL == cs->co)
   {
     GNUNET_break (0);
@@ -347,10 +354,6 @@ salt_cb (void *cls,
 }
 
 
-static void
-start_read_keyboard (void);
-
-
 /**
  * @brief Read the character from stdin and activate the selected task
  *
@@ -436,7 +439,6 @@ read_keyboard_command (void *cls)
     else
       printf ("Please add a server before!\n");
 
-    start_read_keyboard ();
     free (buffer);
     buffer = NULL;
     return;
@@ -446,21 +448,26 @@ read_keyboard_command (void *cls)
                     strlen ("server add")))
   {
     // FIXME "server add" logic here
-    struct TruthUploadState tus;
+    struct TruthUploadState *tus;
     struct SaltState *ss;
+
     size_t url_len = characters - strlen ("server add ");
     ss = GNUNET_new (struct SaltState);
+    tus = GNUNET_new (struct TruthUploadState);
 
     char *url = &buffer[strlen ("server add ")];
-    tus.backend_url = GNUNET_malloc (url_len);
-    strncpy (tus.backend_url,
+    tus->backend_url = GNUNET_malloc (url_len);
+    strncpy (tus->backend_url,
              url,
              url_len);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "At %s:%d url is %s\n", __FILE__, __LINE__,
+                tus->backend_url);
 
     ss->http_status = MHD_HTTP_OK;
-    ss->tus = &tus;
+    ss->tus = tus;
     ss->so = ANASTASIS_salt (ctx,
-                             tus.backend_url,
+                             tus->backend_url,
                              salt_cb,
                              ss);
     if (NULL == ss->so)
diff --git a/src/lib/anastasis_api_config.c b/src/lib/anastasis_api_config.c
index e9433fd..9aad899 100644
--- a/src/lib/anastasis_api_config.c
+++ b/src/lib/anastasis_api_config.c
@@ -27,6 +27,7 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include <gnunet/gnunet_json_lib.h>
+#include <taler/taler_json_lib.h>
 #include "anastasis_service.h"
 #include "anastasis_api_curl_defaults.h"
 
@@ -59,7 +60,7 @@ handle_config_finished (void *cls,
     {
       struct GNUNET_JSON_Specification spec[] = {
         GNUNET_JSON_spec_string ("methods", &co->methods),
-        GNUNET_JSON_spec_fixed_auto ("annual_fee", &co->cost),
+        TALER_JSON_spec_amount ("annual_fee", &co->cost),
         // FIXME add configs
         GNUNET_JSON_spec_end ()
       };

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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