Url = Struct.new("Url", :channel, :nick, :time, :url)
class UrlPlugin < Plugin
+ BotConfig.register BotConfigIntegerValue.new('url.max_urls',
+ :default => 100, :validate => Proc.new{|v| v > 0},
+ :desc => "Maximum number of urls to store. New urls replace oldest ones.")
+
def initialize
super
@registry.set_default(Array.new)
}
url = Url.new(m.target, m.sourcenick, Time.new, urlstr)
debug "#{list.length} urls so far"
- if list.length > 50 # TODO make this configurable
+ if list.length > @bot.config['url.max_urls']
list.pop
end
debug "storing url #{url.url}"