]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/ircbot.rb
[registry] migrate tc directory name to registry_tc
[user/henk/code/ruby/rbot.git] / lib / rbot / ircbot.rb
index 02414a0747dd5501ad0613feb094cbbe269796be..8b827f15fb59484c88c54df7e0523cd88a51638a 100644 (file)
@@ -292,7 +292,7 @@ class Bot
       :desc => "The CA file used to verify the SSL connection.",
       :wizard => true)
     Config.register Config::StringValue.new('server.ssl_ca_path',
-      :default => '', :requires_restart => true,
+      :default => default_ssl_ca_path, :requires_restart => true,
       :desc => "Alternativly a directory that includes CA PEM files used to verify the SSL connection.",
       :wizard => true)
     Config.register Config::StringValue.new('server.password',
@@ -435,8 +435,8 @@ class Bot
       },
       :desc => "Percentage of IRC penalty to consider when sending messages to prevent being disconnected for excess flood. Set to 0 to disable penalty control.")
     Config.register Config::StringValue.new('core.db',
-      :default => "dbm",
-      :wizard => true, :default => "dbm",
+      :default => default_db,
+      :wizard => true,
       :validate => Proc.new { |v| Registry::formats.include? v },
       :requires_restart => true,
       :desc => "DB adaptor to use for storing the plugin data/registries. Options: " + Registry::formats.join(', '))
@@ -504,6 +504,7 @@ class Bot
     end
 
     @registry_factory = Registry.new @config['core.db']
+    @registry_factory.migrate_registry_folder(path)
 
     @logfile = @config['log.file']
     if @logfile.class!=String || @logfile.empty?
@@ -822,6 +823,21 @@ class Bot
     end
   end
 
+  def default_ssl_ca_path
+    file = default_ssl_ca_file
+    File.dirname file if file
+  end
+
+  # Determine if tokyocabinet is installed, if it is use it as a default.
+  def default_db
+    begin
+      require 'tokyocabinet'
+      return 'tc'
+    rescue LoadError
+      return 'dbm'
+    end
+  end
+
   def repopulate_botclass_directory
     template_dir = File.join Config::datadir, 'templates'
     if FileTest.directory? @botclass