X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frbot%2Fircbot.rb;h=8b827f15fb59484c88c54df7e0523cd88a51638a;hb=b955d424d89655a04ba5f06d3cfee482ae33e713;hp=02414a0747dd5501ad0613feb094cbbe269796be;hpb=5512a41c689e231cee170fce3cfd015384921b47;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 02414a07..8b827f15 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -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