From e8d25c85e530ab7e3294801355590fac470fddaa Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 13 Mar 2008 23:18:29 +0100 Subject: filters: filter_names(group=nil) method to retrieve available filters --- lib/rbot/core/utils/filters.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/rbot/core/utils/filters.rb b/lib/rbot/core/utils/filters.rb index 7535ff42..561d5ebf 100644 --- a/lib/rbot/core/utils/filters.rb +++ b/lib/rbot/core/utils/filters.rb @@ -111,6 +111,18 @@ module ::Irc end end + # This method is used to retrieve the filter names (in a given group) + def filter_names(group=nil) + if group + gkey = group.to_sym + return [] unless defined? @filter_group and @filter_group.key?(gkey) + return @filter_group[gkey].keys + else + return [] unless defined? @filters + return @filters.keys + end + end + # This method clears the filter list and installs the identity filter def clear_filters @filters ||= {} -- cgit v1.2.3