]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/zsi.pl
ws
[infobot.git] / src / Modules / zsi.pl
index 51600a5db0c091c7589ebc6fdce1f0f23ebbb85d..0347a027f3eb41b1bde6bcf54256d1e05e4e2e86 100644 (file)
@@ -26,6 +26,8 @@ package zsi;
 
 my $no_zsi;
 
+use strict;
+
 BEGIN {
        $no_zsi = 0;
        eval "use LWP::UserAgent";
@@ -43,7 +45,7 @@ sub queryText {
        my $res_return = 5;
 
        my $ua = new LWP::UserAgent;
-  $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy"));
+       $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy"));
 
        $ua->timeout(10);
 
@@ -55,7 +57,7 @@ sub queryText {
        }
 
        my $request = new HTTP::Request('GET', "$searchpath");
-       my $response = $ua->request($request); 
+       my $response = $ua->request($request);
 
        if (!$response->is_success) {
                return "Something failed in connecting to the ZSI web server. Try again later.";
@@ -64,7 +66,7 @@ sub queryText {
        my $content = $response->content;
 
        if ($content =~ /No entries found/im) {
-               return "$result No results were found searching ZSI for '$query'.";
+               return "No results were found searching ZSI for '$query'.";
        }
 
        my $res_count = 0; #local counter
@@ -73,12 +75,12 @@ sub queryText {
        my @lines = split(/\n/,$content);
 
        my $result = '';
-       foreach $line(@lines) {
+       foreach my $line (@lines) {
                if (length($line) > 10) {
                        my ($name, $href, $desc) = split(/\|/,$line);
 
                        if ($res_count < $res_return) {
-                               $result .= "$name ($desc) $href\n";
+                               $result .= "$name ($desc) $href : ";
                                $res_display ++;
                        }
                        $res_count ++;
@@ -86,7 +88,7 @@ sub queryText {
        }
 
        if (($query) && ($res_count > $res_display)) {
-               $result .= "$res_display of $res_count shown. All at http://killefiz.de/zaurus/search.php?q=$query\n";
+               $result .= "$res_display of $res_count shown. All at http://killefiz.de/zaurus/search.php?q=$query";
        }
 
        return $result;
@@ -95,7 +97,7 @@ sub queryText {
 sub query {
        my ($args) = @_;
        &::performStrictReply(&queryText($args));
-  return;
+       return;
 }
 
 1;