gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis-gtk] branch master updated: properly encode postal addr


From: gnunet
Subject: [taler-anastasis-gtk] branch master updated: properly encode postal address
Date: Sat, 10 Apr 2021 23:43:12 +0200

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

grothoff pushed a commit to branch master
in repository anastasis-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new 6f552c7  properly encode postal address
6f552c7 is described below

commit 6f552c7810e8a652e3f761ee05b3e4253a7866e5
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Apr 10 23:43:03 2021 +0200

    properly encode postal address
---
 src/anastasis/anastasis-gtk_handle-method-post.c | 45 +++++++++++++++---------
 1 file changed, 29 insertions(+), 16 deletions(-)

diff --git a/src/anastasis/anastasis-gtk_handle-method-post.c 
b/src/anastasis/anastasis-gtk_handle-method-post.c
index fdf766c..5269548 100644
--- a/src/anastasis/anastasis-gtk_handle-method-post.c
+++ b/src/anastasis/anastasis-gtk_handle-method-post.c
@@ -70,6 +70,7 @@ anastasis_gtk_b_post_dialog_response_cb (GtkDialog *dialog,
 {
   GtkBuilder *builder = GTK_BUILDER (user_data);
   json_t *args;
+  char *addr_s;
   char *ins;
 
   if (GTK_RESPONSE_OK != response_id)
@@ -82,28 +83,40 @@ anastasis_gtk_b_post_dialog_response_cb (GtkDialog *dialog,
                    _ ("postal address %s"),
                    gt (builder,
                        "anastasis_gtk_b_post_dialog_postcode_entry"));
-  args = json_pack ("{ s:{s:s, s:{s:s,s:s,s:s,s:s,s:s}, s:s}}",
+  {
+    json_t *addr;
+
+    addr = json_pack ("{s:s,s:s,s:s,s:s,s:s}",
+                      "full_name",
+                      gt (builder,
+                          "anastasis_gtk_b_post_dialog_full_name_entry"),
+                      "street",
+                      gt (builder,
+                          "anastasis_gtk_b_post_dialog_street_entry"),
+                      "city",
+                      gt (builder,
+                          "anastasis_gtk_b_post_dialog_city_entry"),
+                      "postcode",
+                      gt (builder,
+                          "anastasis_gtk_b_post_dialog_postcode_entry"),
+                      "country",
+                      gt (builder,
+                          "anastasis_gtk_b_post_dialog_country_entry"));
+    GNUNET_assert (NULL != addr);
+    addr_s = json_dumps (addr,
+                         JSON_COMPACT | JSON_SORT_KEYS);
+    json_decref (addr);
+  }
+  args = json_pack ("{ s:{s:s, s:o, s:s}}",
                     "authentication_method",
                     "type",
                     "post",
                     "challenge",
-                    "full_name",
-                    gt (builder,
-                        "anastasis_gtk_b_post_dialog_full_name_entry"),
-                    "street",
-                    gt (builder,
-                        "anastasis_gtk_b_post_dialog_street_entry"),
-                    "city",
-                    gt (builder,
-                        "anastasis_gtk_b_post_dialog_city_entry"),
-                    "postcode",
-                    gt (builder,
-                        "anastasis_gtk_b_post_dialog_postcode_entry"),
-                    "country",
-                    gt (builder,
-                        "anastasis_gtk_b_post_dialog_country_entry"),
+                    GNUNET_JSON_from_data (addr_s,
+                                           strlen (addr_s)),
                     "instructions",
                     ins);
+  free (addr_s);
   GNUNET_free (ins);
   gtk_widget_destroy (GTK_WIDGET (dialog));
   g_object_unref (G_OBJECT (builder));

-- 
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]