X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Furl.rb;h=b04beb871be52588c98d45145b030eb1fe8d915d;hb=6b4751c8b6e99dcff80cfe5e66c746cf9106dc6a;hp=821b0cc7f12dd66fa95b0585877e9be9addfc587;hpb=616ce7081f6edef31c60e3aed465de3a3a3d8fd2;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index 821b0cc7..b04beb87 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -275,7 +275,7 @@ class UrlPlugin < Plugin :default => 100, :validate => Proc.new{|v| v > 0}, :desc => "Maximum number of urls to store. New urls replace oldest ones.") BotConfig.register BotConfigBooleanValue.new('url.display_link_info', - :default => true, + :default => false, :desc => "Get the title of any links pasted to the channel and display it (also tells if the link is broken or the site is down)") def initialize @@ -346,13 +346,13 @@ class UrlPlugin < Plugin raise "Error: Maximum redirects hit." end - puts "+ Getting #{uri_str}" + debug "+ Getting #{uri_str}" url = URI.parse(uri_str) return if url.scheme !~ /https?/ title = nil - puts "+ connecting to #{url.host}:#{url.port}" + debug "+ connecting to #{url.host}:#{url.port}" http = @bot.httputil.get_proxy(url) http.start { |http| url.path = '/' if url.path == '' @@ -363,15 +363,15 @@ class UrlPlugin < Plugin when Net::HTTPRedirection, Net::HTTPMovedPermanently then # call self recursively if this is a redirect redirect_to = response['location'] || './' - puts "+ redirect location: #{redirect_to.inspect}" + debug "+ redirect location: #{redirect_to.inspect}" url = URI.join url.to_s, redirect_to - puts "+ whee, redirecting to #{url.to_s}!" + debug "+ whee, redirecting to #{url.to_s}!" return get_title_for_url(url.to_s, depth-1) when Net::HTTPSuccess then if response['content-type'] =~ /^text\// # since the content is 'text/*' and is small enough to # be a webpage, retrieve the title from the page - puts "+ getting #{url.request_uri}" + debug "+ getting #{url.request_uri}" data = read_data_from_response(response, 50000) return get_title_from_html(data) else