gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26275 - gnunet-gtk/src/fs


From: gnunet
Subject: [GNUnet-SVN] r26275 - gnunet-gtk/src/fs
Date: Mon, 4 Mar 2013 02:18:47 +0100

Author: LRN
Date: 2013-03-04 02:18:46 +0100 (Mon, 04 Mar 2013)
New Revision: 26275

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
Log:
Insert SKS into KBlocks to advertise the namespace

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2013-03-04 01:18:43 UTC 
(rev 26274)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2013-03-04 01:18:46 UTC 
(rev 26275)
@@ -2047,6 +2047,38 @@
 
 
 /**
+ * Insert namespace advertisement into metadata when
+ * publishing in both private namespace and global namespace.
+ *
+ * @param cls closure, a 'struct MainPublishingDialogContext *'
+ * @param fi the entry in the publish-structure
+ * @param length length of the file or directory
+ * @param meta metadata for the file or directory (can be modified)
+ * @param uri pointer to the keywords that will be used for this entry (can be 
modified)
+ * @param bo block options (can be modified)
+ * @param do_index should we index (can be modified)
+ * @param client_info pointer to client context set upon creation (can be 
modified)
+ * @return GNUNET_OK to continue, GNUNET_NO to remove
+ *         this entry from the directory, GNUNET_SYSERR
+ *         to abort the iteration
+ */
+static int
+insert_advertisement (void *cls, struct GNUNET_FS_FileInformation *fi,
+    uint64_t length, struct GNUNET_CONTAINER_MetaData *meta,
+    struct GNUNET_FS_Uri **uri,
+    struct GNUNET_FS_BlockOptions *bo, int *do_index,
+    void **client_info)
+{
+  struct MainPublishingDialogContext *ctx = cls;
+
+  GNUNET_FS_namespace_insert_advertisement_into_metadata (
+    ctx->ns, meta, "/");
+
+  return GNUNET_SYSERR;
+}
+
+
+/**
  * The user pushed the 'execute' button.  Start the publishing
  * operation and clean up the memory and the window itself.
  *
@@ -2066,6 +2098,7 @@
   gboolean do_global;
   gboolean do_updateable;
   gboolean do_own;
+  gboolean disable_ads_insertion;
 
   if (NULL != ctx->adddir_head)
   {
@@ -2076,6 +2109,13 @@
   do_global = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(ctx->global_checkbox));
   do_updateable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(ctx->updateable_checkbox));
   do_own = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(ctx->own_checkbox));
+
+  disable_ads_insertion = GNUNET_CONFIGURATION_get_value_yesno (
+      GNUNET_FS_GTK_get_configuration (), "gnunet-fs-gtk",
+      "DISABLE_AUTOMATIC_NAMESPACE_ADVERTISEMENT_INSERTION");
+  if (disable_ads_insertion == GNUNET_SYSERR)
+    disable_ads_insertion = GNUNET_NO;
+
   ns = NULL;
   namespace_id = NULL;
   namespace_uid = NULL;
@@ -2116,6 +2156,8 @@
     do
     {
       fi = get_file_information (ctx->file_info_treemodel, &iter);
+      if (do_global && do_own && !disable_ads_insertion)
+        GNUNET_FS_file_information_inspect (fi, insert_advertisement, ctx);
       /* FIXME-FEATURE-BUG-MINOR: should we convert namespace id and uid from 
UTF8? */
       GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), 
                               fi, ns,




reply via email to

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