summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-07-24 00:01:18 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-07-24 00:01:18 +0000
commit3150e83c5eb61b5c79fdb3570cb35b41aeca4626 (patch)
treee508ecff871c6a340a6ff6cebea524f3e89d6559 /data
parent287a469cb56ca185fe45a0073ee7c57f6bc75e01 (diff)
Cleanups and bugfixes for the RSS plugin
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/rss.rb26
1 files 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