summaryrefslogtreecommitdiff
path: root/data/rbot/plugins
diff options
context:
space:
mode:
authorChris Gahan <chris@ill-logic.com>2006-01-26 17:38:47 +0000
committerChris Gahan <chris@ill-logic.com>2006-01-26 17:38:47 +0000
commit576d95621f715d48845472b2e29c0a0c0996020f (patch)
tree7d9b7d611cfb4a45696bebc424a2868e7461aa1e /data/rbot/plugins
parent360bed41ac8ac97419ac40cb971fba94a425ca19 (diff)
Fixed a bunch of bugs:
* Now uses the @bot.httputil proxy * Broken URLs weren't working because I forgot to rename a variable :P~~ * Left out [Link Info] from the error messages * Surprise bugfix! (i forget what it was :D)
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r--data/rbot/plugins/url.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb
index 08fb1f40..f13398a8 100644
--- a/data/rbot/plugins/url.rb
+++ b/data/rbot/plugins/url.rb
@@ -38,8 +38,9 @@ class UrlPlugin < Plugin
url = URI.parse(uri_str)
return if url.scheme !~ /https?/
- puts "+ connecting to #{url.host}:#{url.port}"
- title = Net::HTTP.start(url.host, url.port) do |http|
+ puts "+ connecting to #{url.host}:#{url.port}"
+ http = @bot.httputil.get_proxy(url)
+ title = http.start do |http|
url.path = '/' if url.path == ''
head = http.request_head(url.path)
case head
@@ -70,9 +71,9 @@ class UrlPlugin < Plugin
return "[Link Info] type: #{head['content-type']}#{size ? ", size: #{size} bytes" : ""}"
end
when Net::HTTPClientError then
- return "Error getting link (#{response.code} - #{response.message})"
+ return "[Link Info] Error getting link (#{head.code} - #{head.message})"
when Net::HTTPServerError then
- return "Error getting link (#{response.code} - #{response.message})"
+ return "[Link Info] Error getting link (#{head.code} - #{head.message})"
end
end
rescue SocketError => e