From 8b0e2e09f81a7d89ceb52e947e9db12a206a8c37 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Thu, 13 Oct 2005 15:37:44 +0000 Subject: various outstanding changes --- data/rbot/plugins/autoop.rb | 2 +- data/rbot/plugins/freshmeat.rb | 20 +++++++++++++------- data/rbot/plugins/markov.rb | 8 ++++++-- data/rbot/plugins/seen.rb | 2 +- lib/rbot/ircbot.rb | 2 ++ 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/data/rbot/plugins/autoop.rb b/data/rbot/plugins/autoop.rb index 6187cf4d..cc1e11a9 100644 --- a/data/rbot/plugins/autoop.rb +++ b/data/rbot/plugins/autoop.rb @@ -1,6 +1,6 @@ class AutoOP < Plugin def help(plugin, topic="") - "perform autoop based on hostmask - usage: addop [channel channel ...], rmop [channel], list - list current ops. If you don't specify which channels, all channels are assumed" + "perform autoop based on hostmask - usage: add [channel channel ...], rm [channel], list - list current ops. If you don't specify which channels, all channels are assumed" end def join(m) diff --git a/data/rbot/plugins/freshmeat.rb b/data/rbot/plugins/freshmeat.rb index 20fa7248..eb2dbdf7 100644 --- a/data/rbot/plugins/freshmeat.rb +++ b/data/rbot/plugins/freshmeat.rb @@ -58,16 +58,22 @@ class FreshmeatPlugin < Plugin def freshmeat(m, params) max = params[:limit].to_i max = 8 if max > 8 - xml = @bot.httputil.get(URI.parse("http://images.feedstermedia.com/feedcache/ostg/freshmeat/fm-releases-global.xml")) - unless xml - m.reply "freshmeat news parse failed" - return - end - doc = Document.new xml - unless doc + begin + xml = @bot.httputil.get(URI.parse("http://images.feedstermedia.com/feedcache/ostg/freshmeat/fm-releases-global.xml")) + unless xml + m.reply "freshmeat news parse failed" + return + end + doc = Document.new xml + unless doc + m.reply "freshmeat news parse failed" + return + end + rescue m.reply "freshmeat news parse failed" return end + matches = Array.new max_width = 60 title_width = 0 diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index 6c51af51..e06753fa 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -50,7 +50,10 @@ class MarkovPlugin < Plugin end def ignore?(user=nil) - return @registry['ignore_users'].include?(user) + @registry['ignore_users'].each do |mask| + return true if Irc.netmaskmatch mask, user + end + return false end def ignore(m, params) @@ -154,7 +157,7 @@ class MarkovPlugin < Plugin message = clean_str m.message wordlist = message.split(/\s+/) - return unless wordlist.length > 2 + return unless wordlist.length >= 2 @lastline = message word1, word2 = :nonword, :nonword wordlist.each do |word3| @@ -163,6 +166,7 @@ class MarkovPlugin < Plugin end @registry["#{word1}/#{word2}"] = [:nonword] + return if m.replied? random_markov(m, message) end end diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb index cc0c1792..aec5a064 100644 --- a/data/rbot/plugins/seen.rb +++ b/data/rbot/plugins/seen.rb @@ -79,7 +79,7 @@ class SeenPlugin < Plugin when "JOIN" ret += "joining #{saw.where}" when "QUIT" - ret += "quiting IRC (#{saw.message})" + ret += "quitting IRC (#{saw.message})" when "TOPIC" ret += "changing the topic of #{saw.where} to #{saw.message}" end diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index ddc53d98..89037255 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -599,6 +599,8 @@ class IrcBot debug "no PONG from server for #{diff} seconds, reconnecting" begin @socket.shutdown + # TODO + # raise an exception to get back to the mainloop rescue debug "couldn't shutdown connection (already shutdown?)" end -- cgit v1.2.3