gnunet-search and URIs

View: New views
2 Messages — Rating Filter:   Alert me  

gnunet-search and URIs

by Yunta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

ps.
thank you all for writing gnunet, for your effort, time and result


_______________________________________________
GNUnet-developers mailing list
GNUnet-developers@...
http://lists.gnu.org/mailman/listinfo/gnunet-developers

Re: gnunet-search and URIs

by Christian Grothoff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Looks like a very reasonable place to put the code.  I've cleaned it up a bit,
it's now in SVN, revision 8215.

Thanks!

Christian

On Tuesday 10 February 2009 02:12:21 pm Yunta wrote:

> 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
>
> ps.
> thank you all for writing gnunet, for your effort, time and result
>
>
> _______________________________________________
> GNUnet-developers mailing list
> GNUnet-developers@...
> http://lists.gnu.org/mailman/listinfo/gnunet-developers



_______________________________________________
GNUnet-developers mailing list
GNUnet-developers@...
http://lists.gnu.org/mailman/listinfo/gnunet-developers