X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fslashdot.rb;h=c9e35b9e9592badde10fe4689aa9765e17c55add;hb=24bb60775741d3731400f1e430ef6bf3a2e1b933;hp=ef96a4b01241cf9830263e8b4e59d1f47943af4c;hpb=43ac960aa89e5a02291fe875627dac88ae7fda34;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/slashdot.rb b/data/rbot/plugins/slashdot.rb index ef96a4b0..c9e35b9e 100644 --- a/data/rbot/plugins/slashdot.rb +++ b/data/rbot/plugins/slashdot.rb @@ -1,5 +1,4 @@ require 'rexml/document' -require 'uri/common' class SlashdotPlugin < Plugin include REXML @@ -8,15 +7,10 @@ class SlashdotPlugin < Plugin end def search_slashdot(m, params) - max = params[:limit].to_i - search = params[:search].to_s + max = params[:limit].to_i + search = params[:search].to_s - begin - xml = @bot.httputil.get_cached(URI.parse("http://slashdot.org/search.pl?content_type=rss&query=#{URI.escape(search)}")) - rescue URI::InvalidURIError, URI::BadURIError => e - m.reply "illegal search string #{search}" - return - end + xml = @bot.httputil.get("http://slashdot.org/search.pl?content_type=rss&query=#{CGI.escape(search)}") unless xml m.reply "search for #{search} failed" return @@ -39,7 +33,7 @@ class SlashdotPlugin < Plugin doc.elements.each("*/item") {|e| desc = e.elements["title"].text desc.gsub!(/(.{150}).*/, '\1..') - reply = sprintf("%s | %s", e.elements["link"].text, desc) + reply = sprintf("%s | %s", e.elements["link"].text, desc.ircify_html) m.reply reply done += 1 break if done >= max @@ -53,7 +47,7 @@ class SlashdotPlugin < Plugin debug params.inspect max = params[:limit].to_i debug "max is #{max}" - xml = @bot.httputil.get_cached(URI.parse("http://slashdot.org/slashdot.xml")) + xml = @bot.httputil.get('http://slashdot.org/slashdot.xml') unless xml m.reply "slashdot news parse failed" return