diff options
author | Chris Gahan <chris@ill-logic.com> | 2006-01-28 07:17:18 +0000 |
---|---|---|
committer | Chris Gahan <chris@ill-logic.com> | 2006-01-28 07:17:18 +0000 |
commit | 46cc000b3b9180cb9570a8b9afe1eaa31f622394 (patch) | |
tree | dfb2ef8bd7e593f04fd9827af11b073f4d75fb85 /data/rbot/plugins/url.rb | |
parent | 6a606e8d5b485b578b9fcbe23f5e1fb5210f491f (diff) |
opme now says okay BEFORE opping!
Diffstat (limited to 'data/rbot/plugins/url.rb')
-rw-r--r-- | data/rbot/plugins/url.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index a4e96359..78f89305 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -1,7 +1,7 @@ require 'net/http' require 'uri' require 'cgi' -
+ Url = Struct.new("Url", :channel, :nick, :time, :url) TITLE_RE = /<\s*?title\s*?>(.+?)<\s*?\/title\s*?>/im @@ -38,7 +38,7 @@ class UrlPlugin < Plugin url = URI.parse(uri_str) return if url.scheme !~ /https?/ - puts "+ connecting to #{url.host}:#{url.port}"
+ puts "+ connecting to #{url.host}:#{url.port}" http = @bot.httputil.get_proxy(url) title = http.start do |http| url.path = '/' if url.path == '' @@ -55,7 +55,7 @@ class UrlPlugin < Plugin if head['content-type'] =~ /^text\// # content is 'text/*' # retrieve the title from the page - puts "+ getting #{url.path}" + puts "+ getting #{url.request_uri}" response = http.request_get(url.request_uri) return get_title_from_html(response.body) else @@ -67,7 +67,7 @@ class UrlPlugin < Plugin when Net::HTTPClientError then return "[Link Info] Error getting link (#{head.code} - #{head.message})" when Net::HTTPServerError then - return "[Link Info] Error getting link (#{head.code} - #{head.message})"
+ return "[Link Info] Error getting link (#{head.code} - #{head.message})" end end rescue SocketError => e |