From 3150e83c5eb61b5c79fdb3570cb35b41aeca4626 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 24 Jul 2006 00:01:18 +0000 Subject: Cleanups and bugfixes for the RSS plugin --- data/rbot/plugins/rss.rb | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 74f78e0d..12d7f24a 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -258,16 +258,22 @@ class RSSFeedsPlugin < Plugin m.reply "incorrect usage: " + help(m.plugin) return end - feed = m.params.scan(/^(\S+)\s+(\S+)$/) - url = feed[0][0] - feedFormat = feed[0][1] - if @watchList.has_key?(url) - m.reply("But there is already a watch for feed #{url} on chan #{@watchList[url][1]}") - return + feed = m.params.scan(/(\S+)/) + debug feed.inspect + if feed + url = feed[0] + feedFormat = "" + feedFormat = feed[1] if feed.length > 1 + if @watchList.has_key?(url) + m.reply("But there is already a watch for feed #{url} on chan #{@watchList[url][1]}") + return + end + @watchList[url] = [feedFormat, m.replyto] + watchRss(m.replyto, url,feedFormat) + m.okay + else + m.reply "Wrong syntax" end - @watchList[url] = [feedFormat, m.replyto] - watchRss(m.replyto, url,feedFormat) - @bot.okay(m.replyto) end private @@ -350,7 +356,7 @@ class RSSFeedsPlugin < Plugin def fetchRSS(whichChan, url, title) begin # Use 60 sec timeout, cause the default is too low - xml = Utils.http_get(url,60,60) + xml = @bot.httputil.get_cached(url,60,60) rescue URI::InvalidURIError, URI::BadURIError => e @bot.say whichChan, "invalid rss feed #{url}" return -- cgit v1.2.3