diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2015-03-12 18:41:27 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2015-03-12 18:41:27 +0000 |
commit | 2d17799ac2d48d009dce996a0259f710e8c0e363 (patch) | |
tree | f1bea927b2b66fed990a48f9c7ddc92a80443344 /src/identity/plugin_rest_identity.c | |
parent | 44bd35d03db9385e6b93dd8a60c13582709380d1 (diff) | |
download | gnunet-2d17799ac2d48d009dce996a0259f710e8c0e363.tar.gz gnunet-2d17799ac2d48d009dce996a0259f710e8c0e363.zip |
-add delete REST
Diffstat (limited to 'src/identity/plugin_rest_identity.c')
-rw-r--r-- | src/identity/plugin_rest_identity.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index 2bfcbfe79..bfa4ff848 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c | |||
@@ -263,6 +263,20 @@ ego_info_response (struct RequestHandle *handle) | |||
263 | } | 263 | } |
264 | 264 | ||
265 | static void | 265 | static void |
266 | delete_finished (void *cls, const char *emsg) | ||
267 | { | ||
268 | struct RequestHandle *handle = cls; | ||
269 | |||
270 | handle->op = NULL; | ||
271 | if (NULL != emsg) | ||
272 | { | ||
273 | GNUNET_SCHEDULER_add_now (&do_error, handle); | ||
274 | } | ||
275 | handle->proc (handle->proc_cls, NULL, 0, GNUNET_OK); | ||
276 | cleanup_handle (handle); | ||
277 | } | ||
278 | |||
279 | static void | ||
266 | create_finished (void *cls, const char *emsg) | 280 | create_finished (void *cls, const char *emsg) |
267 | { | 281 | { |
268 | struct RequestHandle *handle = cls; | 282 | struct RequestHandle *handle = cls; |
@@ -351,6 +365,41 @@ subsys_set_cont (struct RequestHandle *handle) | |||
351 | void | 365 | void |
352 | ego_delete_cont (struct RequestHandle *handle) | 366 | ego_delete_cont (struct RequestHandle *handle) |
353 | { | 367 | { |
368 | const char *egoname; | ||
369 | struct EgoEntry *ego_entry; | ||
370 | int ego_exists = GNUNET_NO; | ||
371 | |||
372 | if (strlen (API_NAMESPACE)+1 >= strlen (handle->url)) | ||
373 | { | ||
374 | GNUNET_break(0); | ||
375 | handle->proc (handle->proc_cls, NULL, 0, GNUNET_SYSERR); | ||
376 | cleanup_handle (handle); | ||
377 | return; | ||
378 | } | ||
379 | |||
380 | egoname = &handle->url[strlen(API_NAMESPACE)+1]; | ||
381 | for (ego_entry = handle->ego_head; | ||
382 | NULL != ego_entry; | ||
383 | ego_entry = ego_entry->next) | ||
384 | { | ||
385 | if (0 == strcasecmp (egoname, ego_entry->identifier)) | ||
386 | { | ||
387 | ego_exists = GNUNET_YES; | ||
388 | break; | ||
389 | } | ||
390 | } | ||
391 | if (GNUNET_NO == ego_exists) | ||
392 | { | ||
393 | GNUNET_break(0); | ||
394 | handle->proc (handle->proc_cls, NULL, 0, GNUNET_SYSERR); | ||
395 | cleanup_handle (handle); | ||
396 | return; | ||
397 | } | ||
398 | handle->op = GNUNET_IDENTITY_delete (handle->identity_handle, | ||
399 | egoname, | ||
400 | &delete_finished, | ||
401 | handle); | ||
402 | |||
354 | } | 403 | } |
355 | 404 | ||
356 | void | 405 | void |