summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorRaine Virta <rane@kapsi.fi>2009-02-13 00:22:52 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-02-14 22:24:17 +0100
commitda7a2801cf9ab65603d833a82421d5be0c725bc8 (patch)
treea7c15db9de14620e1eed5fea440018613862e50e /data/rbot
parent041ceb742df2076c93e3fb88fe7a06b5e9c79810 (diff)
last.fm plugin: fixed taste comparison xml parsing failing in case of nonexistent user(s)
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/lastfm.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index 96bdaa48..f9fb1fd3 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -158,15 +158,16 @@ class LastFmPlugin < Plugin
m.reply _("last.fm parsing failed")
return
end
- if xml.class == Net::HTTPInternalServerError
+ if xml.class == Net::HTTPBadRequest
if doc.root.elements["error"].attributes["code"] == "7" then
error = doc.root.elements["error"].text
error.match(/Invalid username: \[(.*)\]/);
- if @registry.has_key? $1 and not params[:recurs]
- if user1 == $1
- params[:user1] = @registry[ $1 ]
- elsif user2 == $1
- params[:user2] = @registry[ $1 ]
+ baduser = $1
+ if @registry.has_key? baduser and not params[:recurs]
+ if user1 == baduser
+ params[:user1] = @registry[baduser]
+ elsif user2 == baduser
+ params[:user2] = @registry[baduser]
end
params[:recurs] = true
tasteometer(m, params)