From ed78f06271350b42b36b4bcd5ede7395529823f6 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Sun, 7 Aug 2005 14:11:42 +0000 Subject: [PATCH] Sun Aug 07 15:11:07 BST 2005 Tom Gilbert * fix address_prefix, broken in 0.9.9, reported by ruskie. --- ChangeLog | 8 ++++++++ Rakefile | 2 +- lib/rbot/ircbot.rb | 7 +------ lib/rbot/message.rb | 6 +++++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4b150d2..d137da10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Aug 07 15:11:07 BST 2005 Tom Gilbert + + * fix address_prefix, broken in 0.9.9, reported by ruskie. + +Sat Aug 06 00:54:34 BST 2005 Tom Gilbert + + * Released 0.9.9 + Fri Aug 05 23:55:20 BST 2005 Tom Gilbert * few more tweaks preparing to release 0.9.9 diff --git a/Rakefile b/Rakefile index 80be9782..80b6dd8c 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,7 @@ require 'rubygems' require 'rake' require 'rake/gempackagetask' -task :default => [:package] +task :default => [:repackage] spec = Gem::Specification.new do |s| s.name = 'rbot' diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index a6a7ab53..7cfda371 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -153,11 +153,6 @@ class IrcBot @socket = IrcSocket.new(@config['server.name'], @config['server.port'], @config['server.bindhost'], @config['server.sendq_delay'], @config['server.sendq_burst']) @nick = @config['irc.nick'] - if @config['core.address_prefix'] - @addressing_prefixes = @config['core.address_prefix'].split(" ") - else - @addressing_prefixes = Array.new - end @client = IrcClient.new @client[:privmsg] = proc { |data| @@ -711,7 +706,7 @@ class IrcBot else # stuff to handle when not addressed case m.message - when (/^\s*(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi(\W|$)|yo(\W|$))[\s,-.]+#{@nick}$/i) + when (/^\s*(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi|yo(\W|$))[\s,-.]+#{@nick}$/i) say m.replyto, @lang.get("hello_X") % m.sourcenick when (/^#{@nick}!*$/) say m.replyto, @lang.get("hello_X") % m.sourcenick diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index d7f614ab..ba5dcb43 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -1,4 +1,8 @@ module Irc + BotConfig.register BotConfigArrayValue.new('core.address_prefix', + :default => [], :wizard => true, + :desc => "what non nick-matching prefixes should the bot respond to as if addressed (e.g !, so that '!foo' is treated like 'rbot: foo')" + ) # base user message class, all user messages derive from this # (a user message is defined as having a source hostmask, a target @@ -127,7 +131,7 @@ module Irc # check for option extra addressing prefixes, e.g "|search foo", or # "!version" - first match wins - bot.addressing_prefixes.each {|mprefix| + bot.config['core.address_prefix'].each {|mprefix| if @message.gsub!(/^#{Regexp.escape(mprefix)}\s*/, "") @address = true break -- 2.32.0.93.g670b81a890