diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-12-14 11:18:54 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-12-14 11:18:54 +0000 |
commit | a4094acbec334dbc9c17abcbff6a87711fc6d78c (patch) | |
tree | 142cf3574ff5b2cc9947681be596bb8b7441802a | |
parent | d95ea514d1e93e7b8691f479448e7d57bf108192 (diff) |
maskdb: be case insenstive
-rw-r--r-- | lib/rbot/irc.rb | 6 | ||||
-rw-r--r-- | lib/rbot/maskdb.rb | 6 |
2 files changed, 10 insertions, 2 deletions
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] } |