diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-13 23:18:29 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-14 00:26:43 +0100 |
commit | e8d25c85e530ab7e3294801355590fac470fddaa (patch) | |
tree | 0ec80c86a172ea3f2e2e9db6eb5f21eefed6abd8 /lib/rbot | |
parent | 61b99d005b86ecd1abe7eb08e698141a07b85a9f (diff) |
filters: filter_names(group=nil) method to retrieve available filters
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/utils/filters.rb | 12 |
1 files changed, 12 insertions, 0 deletions
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 ||= {} |