static struct GNUNET_FS_Uri *topKeywords;
+static struct GNUNET_FS_Uri *uri;
+
static unsigned int anonymity = 1;
static unsigned int priority = 365;
p = pc;
pc = NULL;
GNUNET_FS_publish_stop (p);
+ if (NULL != meta)
+ {
+ GNUNET_CONTAINER_meta_data_destroy (meta);
+ meta = NULL;
+ }
}
}
}
-/**
- * Merge metadata entries.
- *
- * @param cls closure, target metadata structure
- * @param plugin_name name of the plugin that generated the meta data
- * @param type type of the meta data
- * @param format format of data
- * @param data_mime_type mime type of data
- * @param data value of the meta data
- * @param data_size number of bytes in data
- * @return always 0
- */
-static int
-meta_merger (void *cls,
- const char *plugin_name,
- enum EXTRACTOR_MetaType type,
- enum EXTRACTOR_MetaFormat format,
- const char *data_mime_type,
- const char *data,
- size_t data_size)
-{
- struct GNUNET_CONTAINER_MetaData *m = cls;
-
- GNUNET_CONTAINER_meta_data_insert (m,
- plugin_name,
- type,
- format,
- data_mime_type,
- data,
- data_size);
- return 0;
-}
-
-
/**
* Function called on all entries before the publication. This is
* where we perform modifications to the default based on command-line
}
if (NULL != meta)
{
- GNUNET_CONTAINER_meta_data_iterate (meta,
- &meta_merger,
- m);
+ GNUNET_CONTAINER_meta_data_merge (m, meta);
GNUNET_CONTAINER_meta_data_destroy (meta);
meta = NULL;
}
}
+static void
+uri_sks_continuation (void *cls,
+ const struct GNUNET_FS_Uri *ksk_uri,
+ const char *emsg)
+{
+ if (emsg != NULL)
+ {
+ fprintf (stderr,
+ "%s\n",
+ emsg);
+ ret = 1;
+ }
+ GNUNET_FS_uri_destroy (uri);
+ uri = NULL;
+ GNUNET_FS_stop (ctx);
+ ctx = NULL;
+}
+
+
static void
uri_ksk_continuation (void *cls,
- const struct GNUNET_FS_Uri *uri,
+ const struct GNUNET_FS_Uri *ksk_uri,
const char *emsg)
{
+ struct GNUNET_FS_Namespace *ns;
+
if (emsg != NULL)
{
fprintf (stderr,
emsg);
ret = 1;
}
+ if (pseudonym != NULL)
+ {
+ ns = GNUNET_FS_namespace_create (ctx,
+ pseudonym);
+ if (ns == NULL)
+ {
+ fprintf (stderr,
+ _("Failed to create namespace `%s'\n"),
+ pseudonym);
+ ret = 1;
+ }
+ else
+ {
+ GNUNET_FS_publish_sks (ctx,
+ ns,
+ this_id,
+ next_id,
+ meta,
+ uri,
+ GNUNET_TIME_relative_to_absolute (DEFAULT_EXPIRATION),
+ anonymity,
+ priority,
+ GNUNET_FS_PUBLISH_OPTION_NONE,
+ uri_sks_continuation,
+ NULL);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_FS_namespace_delete (ns, GNUNET_NO));
+ return;
+ }
+ }
+ GNUNET_FS_uri_destroy (uri);
+ uri = NULL;
GNUNET_FS_stop (ctx);
+ ctx = NULL;
}
struct stat sbuf;
char *ex;
char *emsg;
- struct GNUNET_FS_Uri *uri;
sched = s;
/* check arguments */
return;
}
}
- if (args[0] == NULL)
+ if ( (args[0] == NULL) &&
+ (uri_string == NULL) )
{
fprintf (stderr,
_("Need the name of a file to publish!\n"));
}
else if (S_ISDIR (sbuf.st_mode))
{
- fi = GNUNET_FS_file_information_create_from_directory (NULL,
+ fi = GNUNET_FS_file_information_create_from_directory (ctx,
+ NULL,
args[0],
&GNUNET_FS_directory_scanner_default,
l,
}
else
{
- fi = GNUNET_FS_file_information_create_from_file (NULL,
+ fi = GNUNET_FS_file_information_create_from_file (ctx,
+ NULL,
args[0],
NULL,
NULL,