]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Google.pl
dunno
[infobot.git] / src / Modules / Google.pl
index a8a66f93de1cdf2b4347e68c6fea0b0861d0ef5f..dd585cc48b16cbe769dc156fad9739164b3a22c6 100644 (file)
@@ -2,7 +2,11 @@
 # was deprecated and requires a key that google no longer provides. 
 # This new module uses REST::Google::Search 
 # Modified by db <db@cave.za.net> 12-01-2008. 
+#
+# Usage: 'chanset _default +Google' in query window with your bot
+#        to enable it in all channels
+#        /msg botnick google <query> OR <addressCharacter>google <query> to use
+
 package Google;
 
 use strict;
@@ -51,9 +55,14 @@ sub GoogleSearch {
     $retval = "$where says \"\002$what\002\" is at ";
     foreach my $r (@results) {
         my $url = $r->url;
+
+        # Returns a string with each %XX sequence replaced with the actual byte
+        # (octet). From URI::Escape uri_unescape()
+        $url =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
+
         $retval .= " \002or\002 " if ( $count > 0 );
         $retval .= $url;
-        last if ++$count >= $maxshow;
+        last if ++$count >= $maxshow; # Only seems to return max of 4?
     }
 
     &::performStrictReply($retval);
@@ -62,3 +71,9 @@ sub GoogleSearch {
 1;
  
 # vim:ts=4:sw=4:expandtab:tw=80 
+# Local Variables:
+# mode: cperl
+# tab-width: 4
+# fill-column: 80
+# indent-tabs-mode: nil
+# End: