aboutsummaryrefslogtreecommitdiff
path: root/src/rest-plugins
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2018-09-27 21:38:44 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2018-09-27 21:38:44 +0200
commit5d9cfaee08499079033580f4cb2a64f82e333511 (patch)
tree5e3e578d5ed51e6a8bf8c430c465e9818b077e40 /src/rest-plugins
parent688561488d42882dfcd87690af9d6144dc67c3c6 (diff)
downloadgnunet-5d9cfaee08499079033580f4cb2a64f82e333511.tar.gz
gnunet-5d9cfaee08499079033580f4cb2a64f82e333511.zip
change attribute api
Diffstat (limited to 'src/rest-plugins')
-rw-r--r--src/rest-plugins/plugin_rest_reclaim.c25
1 files 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,
611 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr) 611 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
612{ 612{
613 struct RequestHandle *handle = cls; 613 struct RequestHandle *handle = cls;
614 json_t *value; 614 json_t *attr_obj;
615 const char* type;
615 char* tmp_value; 616 char* tmp_value;
616 617
617 if ((NULL == attr->name) || (NULL == attr->data)) 618 if ((NULL == attr->name) || (NULL == attr->data))
@@ -627,12 +628,20 @@ attr_collect (void *cls,
627 attr->data, 628 attr->data,
628 attr->data_size); 629 attr->data_size);
629 630
630 value = json_string (tmp_value); 631 attr_obj = json_object ();
631 632 json_object_set_new (attr_obj,
632 json_object_set_new (handle->resp_object, 633 "value",
633 attr->name, 634 json_string (tmp_value));
634 value); 635 json_object_set_new (attr_obj,
635 json_decref (value); 636 "name",
637 json_string (attr->name));
638 type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
639 json_object_set_new (attr_obj,
640 "type",
641 json_string (type));
642 json_array_append (handle->resp_object,
643 attr_obj);
644 json_decref (attr_obj);
636 GNUNET_free(tmp_value); 645 GNUNET_free(tmp_value);
637 GNUNET_RECLAIM_get_attributes_next (handle->attr_it); 646 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
638} 647}
@@ -672,7 +681,7 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
672 ego_entry = ego_entry->next) 681 ego_entry = ego_entry->next)
673 if (0 == strcmp (identity, ego_entry->identifier)) 682 if (0 == strcmp (identity, ego_entry->identifier))
674 break; 683 break;
675 handle->resp_object = json_object (); 684 handle->resp_object = json_array ();
676 685
677 686
678 if (NULL == ego_entry) 687 if (NULL == ego_entry)