]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/weather.rb
weather plugin: fix 163
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / weather.rb
index 4edcc96381b2d4c52fe822d42d713c1db2b07183..47ab1ca259fe4f330a4bb32563b25770f8c689bd 100644 (file)
@@ -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(", ")