diff options
author | Raine Virta <rane@kapsi.fi> | 2009-03-05 20:00:36 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-03-10 21:55:53 +0100 |
commit | cace302f6134deb31fc662f8a6fe8ba7a45fc8fb (patch) | |
tree | 8b1575fd92c90b83c7987a06aed00459f3e79917 /data/rbot/plugins | |
parent | 2fae558c586496f6d4f2ed59b725f520db9a587e (diff) |
url: allow ignoring urls from specific users
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r-- | data/rbot/plugins/url.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index e380f29b..4ff27fab 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -31,6 +31,9 @@ class UrlPlugin < Plugin Config.register Config::ArrayValue.new('url.only_on_channels', :desc => "Show link info only on these channels", :default => []) + Config.register Config::ArrayValue.new('url.ignore', + :desc => "Don't show link info for urls from users represented as hostmasks on this list. Useful for ignoring other bots, for example.", + :default => []) def initialize super @@ -125,15 +128,20 @@ class UrlPlugin < Plugin def handle_urls(m, params={}) opts = { :display_info => @bot.config['url.display_link_info'], - :channels => @bot.config['url.only_on_channels'] + :channels => @bot.config['url.only_on_channels'], + :ignore => @bot.config['url.ignore'] }.merge params urls = opts[:urls] display_info= opts[:display_info] channels = opts[:channels] + ignore = opts[:ignore] + unless channels.empty? return unless channels.map { |c| c.downcase }.include?(m.channel.downcase) end + ignore.each { |u| return if m.source.matches?(u) } + return if urls.empty? debug "found urls #{urls.inspect}" list = m.public? ? @registry[m.target] : nil |