gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: change attribute api


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: change attribute api
Date: Thu, 27 Sep 2018 21:38:49 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 5d9cfaee0 change attribute api
5d9cfaee0 is described below

commit 5d9cfaee08499079033580f4cb2a64f82e333511
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Thu Sep 27 21:38:44 2018 +0200

    change attribute api
---
 src/rest-plugins/plugin_rest_reclaim.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/rest-plugins/plugin_rest_reclaim.c 
b/src/rest-plugins/plugin_rest_reclaim.c
index 9115a9449..e85ae09fe 100644
--- a/src/rest-plugins/plugin_rest_reclaim.c
+++ b/src/rest-plugins/plugin_rest_reclaim.c
@@ -611,7 +611,8 @@ attr_collect (void *cls,
               const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
 {
   struct RequestHandle *handle = cls;
-  json_t *value;
+  json_t *attr_obj;
+  const char* type;
   char* tmp_value;
 
   if ((NULL == attr->name) || (NULL == attr->data))
@@ -627,12 +628,20 @@ attr_collect (void *cls,
                                                         attr->data,
                                                         attr->data_size);
 
-  value = json_string (tmp_value);
-
-  json_object_set_new (handle->resp_object,
-                       attr->name,
-                       value);
-  json_decref (value);
+  attr_obj = json_object ();
+  json_object_set_new (attr_obj,
+                   "value",
+                   json_string (tmp_value));
+  json_object_set_new (attr_obj,
+                   "name",
+                   json_string (attr->name));
+  type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
+  json_object_set_new (attr_obj,
+                       "type",
+                       json_string (type));
+  json_array_append (handle->resp_object,
+                     attr_obj);
+  json_decref (attr_obj);
   GNUNET_free(tmp_value);
   GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
 }
@@ -672,7 +681,7 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle 
*con_handle,
        ego_entry = ego_entry->next)
     if (0 == strcmp (identity, ego_entry->identifier))
       break;
-  handle->resp_object = json_object ();
+  handle->resp_object = json_array ();
 
 
   if (NULL == ego_entry)

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



reply via email to

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