gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r8215 - GNUnet/src/applications/fs/ecrs


From: gnunet
Subject: [GNUnet-SVN] r8215 - GNUnet/src/applications/fs/ecrs
Date: Tue, 10 Feb 2009 20:30:23 -0700 (MST)

Author: grothoff
Date: 2009-02-10 20:30:23 -0700 (Tue, 10 Feb 2009)
New Revision: 8215

Modified:
   GNUnet/src/applications/fs/ecrs/helper.c
Log:
[GNUnet-developers] gnunet-search and URIs
From: 
Yunta <address@hidden>
  To: 
address@hidden
  Date: 
Today 02:12:21 pm
   
  Spam Status: Spamassassin -5% probability of being spam.

Full report:
No  
Hi,

gnunet-search's man says you can give it URI instead of keywords
it didn't work for me (rev 8213), so I wrote this:


Index: src/applications/fs/ecrs/helper.c
===================================================================
--- src/applications/fs/ecrs/helper.c   (revision 8213)
+++ src/applications/fs/ecrs/helper.c   (working copy)
@@ -160,6 +160,18 @@

   if (num_keywords == 0)
     return NULL;
+
+  if (num_keywords == 1)
+    {
+      if (strlen(keywords[0])>strlen(GNUNET_ECRS_URI_PREFIX))
+        {
+          if 
(strncmp(keywords[0],GNUNET_ECRS_URI_PREFIX,strlen(GNUNET_ECRS_URI_PREFIX))
== 0)
+            {
+              return GNUNET_ECRS_string_to_uri(ectx, keywords[0]);
+            }
+        }
+    }
+
   uri = GNUNET_malloc (sizeof (URI));
   uri->type = ksk;
   uri->data.ksk.keywordCount = num_keywords;


and it works (or just looks like it's working)
I don't know gnunet's code (it took me 1 hour to write this) so it can
be totally wrong.
And probably it is placed incorrectly.
Anyway, it may be better than nothing :)


br,
yunta



Modified: GNUnet/src/applications/fs/ecrs/helper.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/helper.c    2009-02-10 21:57:01 UTC (rev 
8214)
+++ GNUnet/src/applications/fs/ecrs/helper.c    2009-02-11 03:30:23 UTC (rev 
8215)
@@ -160,6 +160,13 @@
 
   if (num_keywords == 0)
     return NULL;
+  /* allow URI to be given as one and only keyword and
+     handle accordingly */
+  if ( (num_keywords == 1) &&
+       (strlen(keywords[0]) > strlen(GNUNET_ECRS_URI_PREFIX)) &&
+       (strncmp(keywords[0], GNUNET_ECRS_URI_PREFIX, 
strlen(GNUNET_ECRS_URI_PREFIX)) ) &&
+       (NULL != (uri = GNUNET_ECRS_string_to_uri(ectx, keywords[0])) ) )
+    return uri;
   uri = GNUNET_malloc (sizeof (URI));
   uri->type = ksk;
   uri->data.ksk.keywordCount = num_keywords;





reply via email to

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