X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fkeywords.rb;h=83185d9ff5cca97721e714283f6f04a75de4ea11;hb=44688c76d937c2dade10aaa7bb7e70e508b33684;hp=8065e8b807f13229bf12ee92b9dd47d8a72b3357;hpb=e92949d699eb5cacde8abbd1dddbefcb1d0d3a4a;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/keywords.rb b/lib/rbot/keywords.rb index 8065e8b8..83185d9f 100644 --- a/lib/rbot/keywords.rb +++ b/lib/rbot/keywords.rb @@ -131,12 +131,10 @@ module Irc puts "upgrading keyword db #{f} (rbot 0.9.5 or prior) database format" newname = f.gsub(/\.db$/, ".kdb") old = BDB::Hash.open f, nil, - "r+", 0600, "set_pagesize" => 1024, - "set_cachesize" => [0, 32 * 1024, 0] - new = BDB::CIBtree.open newname, nil, - BDB::CREATE | BDB::EXCL | BDB::TRUNCATE, - 0600, "set_pagesize" => 1024, - "set_cachesize" => [0, 32 * 1024, 0] + "r+", 0600 + new = BDB::CIBtree.open(newname, nil, + BDB::CREATE | BDB::EXCL, + 0600) old.each {|k,v| new[k] = v } @@ -186,12 +184,10 @@ module Irc if File.exist?("#{@bot.botclass}/keywords.db") puts "upgrading old keywords (rbot 0.9.5 or prior) database format" old = BDB::Hash.open "#{@bot.botclass}/keywords.db", nil, - "r+", 0600, "set_pagesize" => 1024, - "set_cachesize" => [0, 32 * 1024, 0] + "r+", 0600 new = BDB::CIBtree.open "#{@bot.botclass}/keyword.db", nil, - BDB::CREATE | BDB::EXCL | BDB::TRUNCATE, - 0600, "set_pagesize" => 1024, - "set_cachesize" => [0, 32 * 1024, 0] + BDB::CREATE | BDB::EXCL, + 0600 old.each {|k,v| new[k] = v } @@ -250,6 +246,7 @@ module Irc # # handle a message asking about a keyword def keyword(m, key, dunno=true) + return if key.nil? unless(kw = self[key]) m.reply @bot.lang.get("dunno") if (dunno) return