summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/fish.rb
diff options
context:
space:
mode:
authorAlexander Beisig <alexander.beisig@gmx.de>2006-10-17 11:44:57 +0000
committerAlexander Beisig <alexander.beisig@gmx.de>2006-10-17 11:44:57 +0000
commitea3e6deb696f6336fef8680140db818b8237d0bf (patch)
tree0ac4d45950d9fcb95a1c4525e35c966cec3b471a /data/rbot/plugins/fish.rb
parent40e622c4ae1ccf8b9dfcec133d5f33f1d8b1217c (diff)
Hopefully made the babelfish plugin a bit more robust
Diffstat (limited to 'data/rbot/plugins/fish.rb')
-rw-r--r--data/rbot/plugins/fish.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/data/rbot/plugins/fish.rb b/data/rbot/plugins/fish.rb
index 57aaafc2..68240659 100644
--- a/data/rbot/plugins/fish.rb
+++ b/data/rbot/plugins/fish.rb
@@ -36,16 +36,22 @@ class BabelPlugin < Plugin
"application/x-www-form-urlencoded"})
if (resp.code == "200")
+ lines = Array.new
resp.body.each_line do |l|
- if(l =~ /^\s+<td bgcolor=white class=s><div style=padding:10px;>(.*)<\/div>/)
- answer = $1
- # cache the answer
- if(answer.length > 0)
- @registry["#{trans_pair}/#{data_text}"] = answer
- end
- m.reply answer
- return
+ lines.push l
+ end
+
+ l = lines.join(" ")
+ debug "babelfish response: #{l}"
+
+ if(l =~ /^\s+<td bgcolor=white class=s><div style=padding:10px;>(.*)<\/div>/)
+ answer = $1
+ # cache the answer
+ if(answer.length > 0)
+ @registry["#{trans_pair}/#{data_text}"] = answer
end
+ m.reply answer
+ return
end
m.reply "couldn't parse babelfish response html :("
else