X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fdelicious.rb;h=c2ab7d5d1625f763d39c9f5b56647b84f5b86472;hb=16336b4a240a4265d1f2df1e30d7b68d3a924287;hp=df42e765f34bdf1715026437a171dd7627b9962b;hpb=1d52d1ba19b55c89df38963a3113d4750b1849d1;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/delicious.rb b/data/rbot/plugins/delicious.rb index df42e765..c2ab7d5d 100644 --- a/data/rbot/plugins/delicious.rb +++ b/data/rbot/plugins/delicious.rb @@ -18,13 +18,13 @@ class DeliciousPlugin < Plugin attr_accessor :last_error - BotConfig.register BotConfigStringValue.new('delicious.user', + Config.register Config::StringValue.new('delicious.user', :default => '', :desc => "Username on del.icio.us") - BotConfig.register BotConfigStringValue.new('delicious.password', + Config.register Config::StringValue.new('delicious.password', :default => '', :desc => "Password on del.icio.us") - BotConfig.register BotConfigStringValue.new('delicious.user_fmt', + Config.register Config::StringValue.new('delicious.user_fmt', :default => 'user:%s', :desc => "How to convert users to tags?") - BotConfig.register BotConfigStringValue.new('delicious.channel_fmt', + Config.register Config::StringValue.new('delicious.channel_fmt', :default => 'channel:%s', :desc => "How to convert channels to tags?") def help(plugin, topic="") @@ -46,7 +46,7 @@ class DeliciousPlugin < Plugin end def diu_add(url, opts = {}) - old = diu_req('get', :url => url).root.get_elements('/posts/post')[0] rescue ni + old = diu_req('get', :url => url).root.get_elements('/posts/post')[0] rescue nil opts[:tags] ||= '' if old opts[:description] ||= old.attribute('description').to_s @@ -62,6 +62,10 @@ class DeliciousPlugin < Plugin def event_url_added(url, options = {}) debug("called with #{url}, #{options.inspect}") + if @bot.config['delicious.user'].empty? + debug "del.icio.us plugin not configured, skipping" + return + end opts = Hash.new opts[:description] = options[:title] || options[:info] || url opts[:extended] = options[:extra] if options[:extra]