summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-14 00:15:47 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-14 00:27:09 +0100
commita5027bf00aadb7859d19b58706c2b7e7eecb726f (patch)
treea1857dfdbb47337c81386ddd742783553920d660
parente8d25c85e530ab7e3294801355590fac470fddaa (diff)
filters: method to get the global filter name of a grouped filter
-rw-r--r--lib/rbot/core/utils/filters.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rbot/core/utils/filters.rb b/lib/rbot/core/utils/filters.rb
index 561d5ebf..b2864bf6 100644
--- a/lib/rbot/core/utils/filters.rb
+++ b/lib/rbot/core/utils/filters.rb
@@ -90,11 +90,17 @@ module ::Irc
fs.inject(ds) { |mid, f| mid = f.call(mid) }
end
+ # This method returns the global filter name for filter _name_
+ # in group _group_
+ def global_filter_name(name, group=nil)
+ (group ? "#{group}.#{name}" : name.to_s).intern
+ end
+
# This method is used to register a new filter
def register_filter(name, group=nil, &block)
raise "No block provided" unless block_given?
@filters ||= {}
- tlkey = ( group ? "#{group}.#{name}" : name.to_s ).intern
+ tlkey = global_filter_name(name, group)
key = name.to_sym
if @filters.key?(tlkey)
debug "Overwriting filter #{tlkey}"