summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/digg.rb2
-rw-r--r--data/rbot/plugins/imdb.rb2
-rw-r--r--data/rbot/plugins/karma.rb2
-rw-r--r--data/rbot/plugins/lart.rb1
-rw-r--r--data/rbot/plugins/math.rb2
-rw-r--r--data/rbot/plugins/quotes.rb6
-rw-r--r--data/rbot/plugins/remind.rb2
-rw-r--r--data/rbot/plugins/slashdot.rb10
-rw-r--r--data/rbot/plugins/url.rb10
-rw-r--r--data/rbot/plugins/wserver.rb2
10 files changed, 20 insertions, 19 deletions
diff --git a/data/rbot/plugins/digg.rb b/data/rbot/plugins/digg.rb
index e125d3c4..8663bd0f 100644
--- a/data/rbot/plugins/digg.rb
+++ b/data/rbot/plugins/digg.rb
@@ -12,7 +12,7 @@ class DiggPlugin < Plugin
def digg(m, params)
max = params[:limit].to_i
- puts "max is #{max}"
+ debug "max is #{max}"
xml = @bot.httputil.get(URI.parse("http://digg.com/rss/index.xml"))
unless xml
m.reply "digg news parse failed"
diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb
index 759e380c..432d0efc 100644
--- a/data/rbot/plugins/imdb.rb
+++ b/data/rbot/plugins/imdb.rb
@@ -39,7 +39,7 @@ class Imdb
def info(rawstr)
sr = search(rawstr)
if !sr
- puts "IMDB : search returned NIL"
+ debug "IMDB: search returned NIL"
return nil
end
resp, data = @http.get(sr, "User-Agent" =>
diff --git a/data/rbot/plugins/karma.rb b/data/rbot/plugins/karma.rb
index 824ffa95..93cf659b 100644
--- a/data/rbot/plugins/karma.rb
+++ b/data/rbot/plugins/karma.rb
@@ -15,7 +15,7 @@ class KarmaPlugin < Plugin
# import if old file format found
if(File.exist?("#{@bot.botclass}/karma.rbot"))
- puts "importing old karma data"
+ log "importing old karma data"
IO.foreach("#{@bot.botclass}/karma.rbot") do |line|
if(line =~ /^(\S+)<=>([\d-]+)$/)
item = $1
diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb
index bf656027..c7200cab 100644
--- a/data/rbot/plugins/lart.rb
+++ b/data/rbot/plugins/lart.rb
@@ -57,6 +57,7 @@ class LartPlugin < Plugin
#{{{
def save
Dir.mkdir("#{@bot.botclass}/lart") if not FileTest.directory? "#{@bot.botclass}/lart"
+ # TODO implement safe saving here too
File.open("#{@bot.botclass}/lart/larts", "w") { |file|
file.puts @larts
}
diff --git a/data/rbot/plugins/math.rb b/data/rbot/plugins/math.rb
index 09e3ed3f..afa4737c 100644
--- a/data/rbot/plugins/math.rb
+++ b/data/rbot/plugins/math.rb
@@ -111,7 +111,7 @@ class MathPlugin < Plugin
end
m.reply answer
rescue Exception => e
- puts "couldn't evaluate expression \"#{m.params}\": #{e}"
+ error "couldn't evaluate expression \"#{m.params}\": #{e.inspect}"
m.reply "illegal expression \"#{m.params}\""
return
end
diff --git a/data/rbot/plugins/quotes.rb b/data/rbot/plugins/quotes.rb
index b795af53..917c6901 100644
--- a/data/rbot/plugins/quotes.rb
+++ b/data/rbot/plugins/quotes.rb
@@ -33,9 +33,9 @@ class QuotePlugin < Plugin
File.rename("#{@bot.botclass}/quotes/new/#{channel}",
"#{@bot.botclass}/quotes/#{channel}")
rescue => e
- $stderr.puts "failed to write quotefile for channel #{channel}!\n#{$!}"
- debug "#{e.class}: #{e}"
- debug e.backtrace.join("\n")
+ error "failed to write quotefile for channel #{channel}!\n#{$!}"
+ error "#{e.class}: #{e}"
+ error e.backtrace.join("\n")
end
}
end
diff --git a/data/rbot/plugins/remind.rb b/data/rbot/plugins/remind.rb
index f66c4fc8..ef9d4be7 100644
--- a/data/rbot/plugins/remind.rb
+++ b/data/rbot/plugins/remind.rb
@@ -175,7 +175,7 @@ class RemindPlugin < Plugin
def remind(m, params)
who = params.has_key?(:who) ? params[:who] : m.sourcenick
string = params[:string].to_s
- puts "in remind, string is: #{string}"
+ debug "in remind, string is: #{string}"
if(string =~ /^(.*)\s+in\s+(.*)$/)
subject = $1
period = $2
diff --git a/data/rbot/plugins/slashdot.rb b/data/rbot/plugins/slashdot.rb
index 1a70de08..30f58dc9 100644
--- a/data/rbot/plugins/slashdot.rb
+++ b/data/rbot/plugins/slashdot.rb
@@ -21,11 +21,11 @@ class SlashdotPlugin < Plugin
m.reply "search for #{search} failed"
return
end
- puts xml.inspect
+ debug xml.inspect
begin
doc = Document.new xml
rescue REXML::ParseException => e
- puts e
+ warning e.inspect
m.reply "couldn't parse output XML: #{e.class}"
return
end
@@ -33,7 +33,7 @@ class SlashdotPlugin < Plugin
m.reply "search for #{search} failed"
return
end
- puts doc.inspect
+ debug doc.inspect
max = 8 if max > 8
done = 0
doc.elements.each("*/item") {|e|
@@ -50,9 +50,9 @@ class SlashdotPlugin < Plugin
end
def slashdot(m, params)
- puts params.inspect
+ debug params.inspect
max = params[:limit].to_i
- puts "max is #{max}"
+ debug "max is #{max}"
xml = @bot.httputil.get(URI.parse("http://slashdot.org/slashdot.xml"))
unless xml
m.reply "slashdot news parse failed"
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb
index 821b0cc7..f5aa88e6 100644
--- a/data/rbot/plugins/url.rb
+++ b/data/rbot/plugins/url.rb
@@ -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
diff --git a/data/rbot/plugins/wserver.rb b/data/rbot/plugins/wserver.rb
index fb4738c1..1baa0d90 100644
--- a/data/rbot/plugins/wserver.rb
+++ b/data/rbot/plugins/wserver.rb
@@ -61,7 +61,7 @@ class WserverPlugin < Plugin
hostname = err.message
retry
rescue StandardError => err
- puts err
+ error err.inspect
m.reply "couldn't connect to #{uri.host}:#{uri.port} :("
return
end