fix
[oweals/gnunet.git] / src / fs / gnunet-pseudonym.c
index b0b53c9254c822b2e2987d19e78b98e094b28fe2..9f85f05457331d74f1861805c73e70ac19c7a108 100644 (file)
@@ -251,7 +251,6 @@ run (void *cls,
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  struct GNUNET_FS_Uri *ns_uri;
   struct GNUNET_TIME_Absolute expiration;
   char *emsg;
 
@@ -261,7 +260,8 @@ run (void *cls,
                       "gnunet-pseudonym",
                       &progress_cb,
                       NULL,
-                      GNUNET_FS_FLAGS_NONE);
+                      GNUNET_FS_FLAGS_NONE,
+                      GNUNET_FS_OPTIONS_END);
   if (NULL != delete_ns)
     {
       ns = GNUNET_FS_namespace_create (h, delete_ns);
@@ -289,9 +289,6 @@ run (void *cls,
        {
          if (NULL != root_identifier)
            {
-             emsg = NULL;
-             ns_uri = GNUNET_FS_uri_sks_create (ns, root_identifier, &emsg);
-             GNUNET_assert (emsg == NULL);
              expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS);
              if (ksk_uri == NULL)
                {
@@ -299,21 +296,33 @@ run (void *cls,
                  ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/namespace", &emsg);
                  GNUNET_assert (NULL == emsg);
                }
-             GNUNET_FS_publish_ksk (h,
-                                    ksk_uri,
-                                    adv_metadata,
-                                    ns_uri,
-                                    expiration,
-                                    anonymity,
-                                    priority,
-                                    GNUNET_FS_PUBLISH_OPTION_NONE,
-                                    &post_advertising,
-                                    NULL);
-             GNUNET_FS_uri_destroy (ns_uri);
+             GNUNET_FS_namespace_advertise (h,
+                                            ksk_uri,
+                                            ns,
+                                            adv_metadata,
+                                            anonymity,
+                                            priority,                                       
+                                            expiration,
+                                            root_identifier,
+                                            &post_advertising,
+                                            NULL);
              return;
            }
+         else
+           {
+             if (ksk_uri != NULL)
+               fprintf (stderr, _("Option `%s' ignored\n"), "-k");   
+           }
        }
     }
+  else
+    {
+      if (root_identifier != NULL) 
+       fprintf (stderr, _("Option `%s' ignored\n"), "-r");
+      if (ksk_uri != NULL)
+       fprintf (stderr, _("Option `%s' ignored\n"), "-k");   
+    }    
+    
   post_advertising (NULL, NULL, NULL);
 }
 
@@ -343,12 +352,12 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
    ("add an additional keyword for the advertisment"
     " (this option can be specified multiple times)"),
    1, &GNUNET_FS_getopt_set_keywords, &ksk_uri},
-  {'l', "local-only", NULL,
-   gettext_noop ("print names of local namespaces"),
-   0, &GNUNET_GETOPT_set_one, &print_local_only},
   {'m', "meta", "TYPE:VALUE",
    gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
    1, &GNUNET_FS_getopt_set_metadata, &adv_metadata},
+  {'o', "only-local", NULL,
+   gettext_noop ("print names of local namespaces"),
+   0, &GNUNET_GETOPT_set_one, &print_local_only},
   {'p', "priority", "PRIORITY",
    gettext_noop ("use the given PRIORITY for the advertisments"),
    1, &GNUNET_GETOPT_set_uint, &priority},