diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-27 02:08:56 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-27 02:08:56 +0100 |
commit | 6faf07c4cc86fbb4f3c07b3c0ef3136f477e9371 (patch) | |
tree | 89eef491349a4f19f092dcf8a1372808ca64e0e1 /data | |
parent | 8797fa565f88d1843011150d95ff6df6e1fefb41 (diff) |
url plugin: option hash for handle_urls()
Turn handle_urls() options (other than the message) into a parameter
hash.
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/url.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index e75224cf..02255318 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -122,7 +122,12 @@ class UrlPlugin < Plugin return extra.join(", ") if title or not @bot.config['url.titles_only'] end - def handle_urls(m, urls, display_info=@bot.config['url.display_link_info']) + def handle_urls(m, params={}) + opts = { + :display_info => @bot.config['url.display_link_info'] + }.merge params + urls = opts[:urls] + display_info= opts[:display_info] unless (channels = @bot.config['url.only_on_channels']).empty? return unless channels.map { |c| c.downcase }.include?(m.channel.downcase) end @@ -184,7 +189,7 @@ class UrlPlugin < Plugin def info(m, params) escaped = URI.escape(params[:urls].to_s, OUR_UNSAFE) urls = URI.extract(escaped) - Thread.new { handle_urls(m, urls, params[:urls].length) } + Thread.new { handle_urls(m, :urls => urls, :display_info => params[:urls].length) } end def message(m) @@ -193,7 +198,7 @@ class UrlPlugin < Plugin escaped = URI.escape(m.message, OUR_UNSAFE) urls = URI.extract(escaped, ['http', 'https']) return if urls.empty? - Thread.new { handle_urls(m, urls) } + Thread.new { handle_urls(m, :urls => urls) } end def reply_urls(opts={}) |