[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 01/75: -wip remove jsonapi from identity
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 01/75: -wip remove jsonapi from identity |
Date: |
Thu, 09 Aug 2018 23:57:58 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 2c2e76228330e4024062a5e8b4ef75f7f04cabbd
Author: Phil <address@hidden>
AuthorDate: Sat Jun 2 00:34:58 2018 +0200
-wip remove jsonapi from identity
---
src/identity/plugin_rest_identity.c | 45 +++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git a/src/identity/plugin_rest_identity.c
b/src/identity/plugin_rest_identity.c
index 6044d0641..97f50ff03 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -349,6 +349,7 @@ get_ego_for_subsys (void *cls,
cleanup_handle (handle);
}
+//TODO clean up, fix memleaks
/**
* Create a response with requested ego(s)
*
@@ -369,9 +370,12 @@ ego_info_response (struct GNUNET_REST_RequestHandle *con,
struct EgoEntry *ego_entry;
struct GNUNET_HashCode key;
struct MHD_Response *resp;
- struct GNUNET_JSONAPI_Document *json_document;
- struct GNUNET_JSONAPI_Resource *json_resource;
+ //struct GNUNET_JSONAPI_Document *json_document;
+ //struct GNUNET_JSONAPI_Resource *json_resource;
+ json_t *json_root;
+ json_t *json_ego;
json_t *name_str;
+ struct GNUNET_JSON_Specification test;
if (GNUNET_NO == GNUNET_REST_namespace_match (handle->url,
GNUNET_REST_API_NS_IDENTITY))
{
@@ -419,7 +423,8 @@ ego_info_response (struct GNUNET_REST_RequestHandle *con,
}
}
- json_document = GNUNET_JSONAPI_document_new ();
+ json_root = json_array();
+ //json_document = GNUNET_JSONAPI_document_new ();
//Return all egos
for (ego_entry = handle->ego_head;
@@ -428,27 +433,39 @@ ego_info_response (struct GNUNET_REST_RequestHandle *con,
{
if ( (NULL != egoname) && (0 != strcmp (egoname, ego_entry->identifier)) )
continue;
- json_resource = GNUNET_JSONAPI_resource_new
(GNUNET_REST_JSONAPI_IDENTITY_EGO,
- ego_entry->keystring);
+
+ //json_resource = GNUNET_JSONAPI_resource_new
(GNUNET_REST_JSONAPI_IDENTITY_EGO,
+ // ego_entry->keystring);
+ json_ego = json_object();
+ json_object_set_new( json_ego, "id", json_string (ego_entry->keystring));
+ json_object_set_new( json_ego, "type", json_string
(GNUNET_REST_JSONAPI_IDENTITY_EGO));
name_str = json_string (ego_entry->identifier);
- GNUNET_JSONAPI_resource_add_attr (
- json_resource,
- GNUNET_REST_JSONAPI_IDENTITY_NAME,
- name_str);
+ json_object_set_new( json_ego, "name", name_str);
+ json_array_append( json_root, json_ego );
+ //GNUNET_JSONAPI_resource_add_attr (
+ // json_resource,
+ // GNUNET_REST_JSONAPI_IDENTITY_NAME,
+ // name_str);
json_decref (name_str);
- GNUNET_JSONAPI_document_resource_add (json_document, json_resource);
+ //GNUNET_JSONAPI_document_resource_add (json_document, json_resource);
}
- if (0 == GNUNET_JSONAPI_document_resource_count (json_document))
+ //if (0 == GNUNET_JSONAPI_document_resource_count (json_document))
+ if (0 == json_array_size(json_root))
{
- GNUNET_JSONAPI_document_delete (json_document);
+ //GNUNET_JSONAPI_document_delete (json_document);
+ json_decref (json_root);
handle->emsg = GNUNET_strdup ("No identities found!");
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
- GNUNET_JSONAPI_document_serialize (json_document, &result_str);
+ //TODO here parse
+ //GNUNET_JSONAPI_document_serialize (json_document, &result_str);
+ //GNUNET_JSON_parse();
+ result_str = json_dumps(json_root, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
resp = GNUNET_REST_create_response (result_str);
- GNUNET_JSONAPI_document_delete (json_document);
+ //GNUNET_JSONAPI_document_delete (json_document);
+ json_decref (json_root);
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
GNUNET_free (result_str);
cleanup_handle (handle);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] branch master updated (389f49398 -> 08c410658), gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 01/75: -wip remove jsonapi from identity,
gnunet <=
- [GNUnet-SVN] [gnunet] 05/75: -merge branch 'master' of ssh://gnunet.org/gnunet into gsoc2018/rest_api, gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 03/75: contrib: rename scripts/report.sh to scripts/gnunet-bugreport and install it., gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 04/75: identity rest api - finished and added test_script, gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 02/75: removed jsonapi structures, gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 08/75: Add GPL2 licensed openrc service file, gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 09/75: gnunet-bugreport: GNUtls->GnuTLS, gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 10/75: fix NPE, gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 14/75: guix-env.scm: Add python2-future., gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 15/75: rps profiler: summarize statistics, gnunet, 2018/08/09
- [GNUnet-SVN] [gnunet] 16/75: add option to disable v6, do not pass chunked encoding along, enable bypass of cert validation, gnunet, 2018/08/09