From a4094acbec334dbc9c17abcbff6a87711fc6d78c Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 14 Dec 2007 11:18:54 +0000 Subject: maskdb: be case insenstive --- lib/rbot/irc.rb | 6 ++++++ lib/rbot/maskdb.rb | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 78c154ec..f3a904e7 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -671,6 +671,12 @@ module Irc self.full_irc_downcase end + # This method returns a new Netmask which is the fully downcased version + # of the receiver + def downcased + return self.full_downcase.to_irc_netmask(server_and_casemap) + end + # Converts the receiver into a Netmask with the given (optional) # server/casemap association. We return self unless a conversion # is needed (different casemap/server) diff --git a/lib/rbot/maskdb.rb b/lib/rbot/maskdb.rb index 435693ec..55dc9839 100644 --- a/lib/rbot/maskdb.rb +++ b/lib/rbot/maskdb.rb @@ -119,7 +119,8 @@ module Irc end def mask2keys(m) - [m.host, m.user, m.nick].map { |c| cook_component(c) } + md = m.downcased + [md.host, md.user, md.nick].map { |c| cook_component(c) } end def add(user, *masks) @@ -147,7 +148,8 @@ module Irc def find(iu) debug "find(#{iu.fullform})" - matches = @tree.find(iu.host, iu.user, iu.nick).uniq.map do |val| + iud = iu.downcased + matches = @tree.find(iud.host, iud.user, iud.nick).uniq.map do |val| m = metric(iu, *val) m ? [val[0], m] : nil end.compact.sort { |a, b| a[1] <=> a[1] } -- cgit v1.2.3