summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/url.rb
diff options
context:
space:
mode:
Diffstat (limited to 'data/rbot/plugins/url.rb')
-rw-r--r--data/rbot/plugins/url.rb10
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