summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-08-21 12:31:41 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-08-21 12:31:41 +0000
commit32f53f6a17396a8828c30c58ce8545c93c04ff2c (patch)
treeb9a54968b9b4b1ad69f67d8cedbab3914c412ac3 /lib/rbot
parentb7572e688c0d44b3632b6077a3e7a936af733568 (diff)
Sun Aug 21 13:29:55 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
* fix for bug in quakenet plugin (trac #14) * multiple fixes for unescaped bot nick in regexp's (trac #13)
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/ircbot.rb13
-rw-r--r--lib/rbot/message.rb2
2 files changed, 5 insertions, 10 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 29d4711d..68c2bd47 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -203,7 +203,7 @@ class IrcBot
sourceurl = data[:sourceaddress]
message = data[:message]
m = QuitMessage.new(self, data[:source], data[:sourcenick], data[:message])
- if(data[:sourcenick] =~ /#{@nick}/i)
+ if(data[:sourcenick] =~ /#{Regexp.escape(@nick)}/i)
else
@channels.each {|k,v|
if(v.users.has_key?(sourcenick))
@@ -255,7 +255,7 @@ class IrcBot
onkick(m)
}
@client[:invite] = proc {|data|
- if(data[:target] =~ /^#{@nick}$/i)
+ if(data[:target] =~ /^#{Regexp.escape(@nick)}$/i)
join data[:channel] if (@auth.allow?("join", data[:source], data[:sourcenick]))
end
}
@@ -500,11 +500,6 @@ class IrcBot
end
# attempt to change bot's nick to +name+
- # FIXME
- # if rbot is already taken, this happens:
- # <giblet> rbot_, nick rbot
- # --- rbot_ is now known as rbot__
- # he should of course just keep his existing nick and report the error :P
def nickchg(name)
sendq "NICK #{name}"
end
@@ -707,9 +702,9 @@ class IrcBot
else
# stuff to handle when not addressed
case m.message
- when (/^\s*(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi|yo(\W|$))[\s,-.]+#{@nick}$/i)
+ when (/^\s*(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi|yo(\W|$))[\s,-.]+#{Regexp.escape(@nick)}$/i)
say m.replyto, @lang.get("hello_X") % m.sourcenick
- when (/^#{@nick}!*$/)
+ when (/^#{Regexp.escape(@nick)}!*$/)
say m.replyto, @lang.get("hello_X") % m.sourcenick
else
@keywords.privmsg(m)
diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb
index ba5dcb43..eabb569a 100644
--- a/lib/rbot/message.rb
+++ b/lib/rbot/message.rb
@@ -141,7 +141,7 @@ module Irc
# even if they used above prefixes, we allow for silly people who
# combine all possible types, e.g. "|rbot: hello", or
# "/msg rbot rbot: hello", etc
- if @message.gsub!(/^\s*#{bot.nick}\s*([:;,>]|\s)\s*/, "")
+ if @message.gsub!(/^\s*#{Regexp.escape(bot.nick)}\s*([:;,>]|\s)\s*/, "")
@address = true
end