]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/delicious.rb
weather: URI-encode station
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / delicious.rb
index bf678303e89ab5d016c6fae8c38d79aee9eb58eb..53da34b41da15917003de9d2baa84d1879747dac 100644 (file)
@@ -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="")
@@ -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]
@@ -74,10 +78,10 @@ class DeliciousPlugin < Plugin
       tags.tr(',', ' ').split(/\s+/).each do |t|
         if t.sub!(/^!/, '')
           case t
-          when 'nolog', 'no-log', 'dont-log', 'dontlog', 'skip':
+          when 'nolog', 'no-log', 'dont-log', 'dontlog', 'skip'
             debug "skipping #{url} on user request"
             return
-          when 'private', 'unshared', 'not-shared', 'notshared', 'hide':
+          when 'private', 'unshared', 'not-shared', 'notshared', 'hide'
             debug "hiding #{url} on user request"
             opts[:shared] = 'no'
           end