gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35378 - gnunet/src/identity


From: gnunet
Subject: [GNUnet-SVN] r35378 - gnunet/src/identity
Date: Thu, 12 Mar 2015 19:41:28 +0100

Author: schanzen
Date: 2015-03-12 19:41:27 +0100 (Thu, 12 Mar 2015)
New Revision: 35378

Modified:
   gnunet/src/identity/plugin_rest_identity.c
Log:
-add delete REST

Modified: gnunet/src/identity/plugin_rest_identity.c
===================================================================
--- gnunet/src/identity/plugin_rest_identity.c  2015-03-12 17:32:37 UTC (rev 
35377)
+++ gnunet/src/identity/plugin_rest_identity.c  2015-03-12 18:41:27 UTC (rev 
35378)
@@ -263,6 +263,20 @@
 }
 
 static void
+delete_finished (void *cls, const char *emsg)
+{
+  struct RequestHandle *handle = cls;
+
+  handle->op = NULL;
+  if (NULL != emsg)
+  {
+    GNUNET_SCHEDULER_add_now (&do_error, handle);
+  }
+  handle->proc (handle->proc_cls, NULL, 0, GNUNET_OK);
+  cleanup_handle (handle);
+}
+
+static void
 create_finished (void *cls, const char *emsg)
 {
   struct RequestHandle *handle = cls;
@@ -351,6 +365,41 @@
 void 
 ego_delete_cont (struct RequestHandle *handle)
 {
+  const char *egoname;
+  struct EgoEntry *ego_entry;
+  int ego_exists = GNUNET_NO;
+
+  if (strlen (API_NAMESPACE)+1 >= strlen (handle->url))
+  {
+    GNUNET_break(0);
+    handle->proc (handle->proc_cls, NULL, 0, GNUNET_SYSERR);
+    cleanup_handle (handle);
+    return;
+  }
+
+  egoname = &handle->url[strlen(API_NAMESPACE)+1];
+  for (ego_entry = handle->ego_head;
+       NULL != ego_entry;
+       ego_entry = ego_entry->next)
+  {
+    if (0 == strcasecmp (egoname, ego_entry->identifier))
+    {
+      ego_exists = GNUNET_YES;
+      break;
+    }
+  }
+  if (GNUNET_NO == ego_exists)
+  {
+    GNUNET_break(0);
+    handle->proc (handle->proc_cls, NULL, 0, GNUNET_SYSERR);
+    cleanup_handle (handle);
+    return;
+  }
+  handle->op = GNUNET_IDENTITY_delete (handle->identity_handle,
+                                       egoname,
+                                       &delete_finished,
+                                       handle);
+
 }
 
 void




reply via email to

[Prev in Thread] Current Thread [Next in Thread]