aboutsummaryrefslogtreecommitdiff
path: root/src/identity/plugin_rest_identity.c
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2015-03-12 18:41:27 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2015-03-12 18:41:27 +0000
commit2d17799ac2d48d009dce996a0259f710e8c0e363 (patch)
treef1bea927b2b66fed990a48f9c7ddc92a80443344 /src/identity/plugin_rest_identity.c
parent44bd35d03db9385e6b93dd8a60c13582709380d1 (diff)
downloadgnunet-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.c49
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
265static void 265static void
266delete_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
279static void
266create_finished (void *cls, const char *emsg) 280create_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)
351void 365void
352ego_delete_cont (struct RequestHandle *handle) 366ego_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
356void 405void