From cace302f6134deb31fc662f8a6fe8ba7a45fc8fb Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Thu, 5 Mar 2009 20:00:36 +0200 Subject: url: allow ignoring urls from specific users --- data/rbot/plugins/url.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'data/rbot') 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 -- cgit v1.2.3