summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-08-07 14:11:42 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-08-07 14:11:42 +0000
commited78f06271350b42b36b4bcd5ede7395529823f6 (patch)
treeb3936d6e9bc1691f92c664d6df37a23cb1c977b7 /lib
parent3b5837cf99d2539e52532e2f6ef4579c7c7930a5 (diff)
Sun Aug 07 15:11:07 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
* fix address_prefix, broken in 0.9.9, reported by ruskie.
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/ircbot.rb7
-rw-r--r--lib/rbot/message.rb6
2 files changed, 6 insertions, 7 deletions
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