summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/weather.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-08 23:06:27 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-08 23:06:27 +0000
commit9cd035d187a581446fd2cecd333fb214b1182ce8 (patch)
treed193554be2f444c1f2eb8ee8f76a3b40331b89ab /data/rbot/plugins/weather.rb
parent5e9c0102fd405848497e84dce6c84bb151287425 (diff)
weather plugin: fix 163
Diffstat (limited to 'data/rbot/plugins/weather.rb')
-rw-r--r--data/rbot/plugins/weather.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb
index 4edcc963..47ab1ca2 100644
--- a/data/rbot/plugins/weather.rb
+++ b/data/rbot/plugins/weather.rb
@@ -190,13 +190,18 @@ class WeatherPlugin < Plugin
case xml
when nil
m.reply "couldn't retrieve weather information, sorry"
- return
when /City Not Found/
m.reply "no such location found (#{where})"
- return
- when /<table border.*?>(.*?)<\/table>/m
- data = $1
- m.reply wu_weather_filter(data)
+ when /<table/
+ data = ""
+ xml.scan(/<table border.*?>(.*?)<\/table>/m).each do |match|
+ data += wu_weather_filter(match.first)
+ end
+ if data.length > 0
+ m.reply data
+ else
+ m.reply "couldn't parse weather data from #{where}"
+ end
when /<a href="\/global\/stations\//
stations = xml.scan(/<a href="\/global\/stations\/(.*?)\.html">/)
m.reply "multiple stations available, use 'weather station <code>' where code is one of " + stations.join(", ")