diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2015-03-11 18:02:26 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2015-03-11 18:02:26 +0000 |
commit | f9c2936425e8c1cfff2e7b07a3588de270628880 (patch) | |
tree | 8488d0f58bdd57ea0efd75cb7afe7ead0bc717ed /src/gns | |
parent | b5cb8ce9b34d0f8cf2eb19cf82680aca365d157f (diff) | |
download | gnunet-f9c2936425e8c1cfff2e7b07a3588de270628880.tar.gz gnunet-f9c2936425e8c1cfff2e7b07a3588de270628880.zip |
-fixes
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/plugin_rest_gns.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index d5d6788c8..2dc140b37 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c | |||
@@ -220,6 +220,7 @@ process_lookup_result (void *cls, uint32_t rd_count, | |||
220 | const char *typename; | 220 | const char *typename; |
221 | char *string_val; | 221 | char *string_val; |
222 | char *result; | 222 | char *result; |
223 | const char *exp_str; | ||
223 | json_t *result_root; | 224 | json_t *result_root; |
224 | json_t *result_name; | 225 | json_t *result_name; |
225 | json_t *result_array; | 226 | json_t *result_array; |
@@ -254,6 +255,24 @@ process_lookup_result (void *cls, uint32_t rd_count, | |||
254 | record_obj = json_object(); | 255 | record_obj = json_object(); |
255 | json_object_set_new (record_obj, "type", json_string (typename)); | 256 | json_object_set_new (record_obj, "type", json_string (typename)); |
256 | json_object_set_new (record_obj, "value", json_string (string_val)); | 257 | json_object_set_new (record_obj, "value", json_string (string_val)); |
258 | |||
259 | if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags) | ||
260 | { | ||
261 | struct GNUNET_TIME_Relative time_rel; | ||
262 | time_rel.rel_value_us = rd[i].expiration_time; | ||
263 | exp_str = GNUNET_STRINGS_relative_time_to_string (time_rel, 1); | ||
264 | } | ||
265 | else | ||
266 | { | ||
267 | struct GNUNET_TIME_Absolute time_abs; | ||
268 | time_abs.abs_value_us = rd[i].expiration_time; | ||
269 | exp_str = GNUNET_STRINGS_absolute_time_to_string (time_abs); | ||
270 | } | ||
271 | json_object_set_new (record_obj, "expiration_time", json_string (exp_str)); | ||
272 | |||
273 | json_object_set_new (record_obj, "expired", | ||
274 | json_boolean (GNUNET_YES == GNUNET_GNSRECORD_is_expired (&(rd[i])))); | ||
275 | |||
257 | json_array_append (result_array, record_obj); | 276 | json_array_append (result_array, record_obj); |
258 | json_decref (record_obj); | 277 | json_decref (record_obj); |
259 | } | 278 | } |
@@ -262,7 +281,7 @@ process_lookup_result (void *cls, uint32_t rd_count, | |||
262 | json_object_set (result_root, "query_result", result_array); | 281 | json_object_set (result_root, "query_result", result_array); |
263 | json_decref (result_array); | 282 | json_decref (result_array); |
264 | result = json_dumps (result_root, JSON_COMPACT); | 283 | result = json_dumps (result_root, JSON_COMPACT); |
265 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Result %s\n", result); | 284 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); |
266 | json_decref (result_root); | 285 | json_decref (result_root); |
267 | handle->proc (handle->proc_cls, result, strlen (result), GNUNET_OK); | 286 | handle->proc (handle->proc_cls, result, strlen (result), GNUNET_OK); |
268 | GNUNET_free (result); | 287 | GNUNET_free (result); |