diff options
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/registry/tc.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/rbot/registry/tc.rb b/lib/rbot/registry/tc.rb index 4477c115..8ffd3e40 100644 --- a/lib/rbot/registry/tc.rb +++ b/lib/rbot/registry/tc.rb @@ -117,15 +117,19 @@ module Irc if absfilename && File.exist?(key) # db already exists, use it @db = DBTree.open_db(key) + @fname = key.dup elsif absfilename # create empty db @db = DBTree.create_db(key) + @fname = key.dup elsif File.exist? relfilename # db already exists, use it @db = DBTree.open_db relfilename + @fname = relfilename.dup else # create empty db @db = DBTree.create_db relfilename + @fname = relfilename.dup end oldbasename = (absfilename ? key : relfilename).gsub(/\.tdb$/, ".db") if File.exists? oldbasename and defined? BDB @@ -155,6 +159,14 @@ module Irc @@bot_registries.clear end + def close + db = @@bot_registries.delete(@fname) + if db != @db + error "We think we have #{@db} from #{@fname}, TC pseudo-env gives us #{db}" + end + @db.close + end + def DBTree.create_db(name) debug "DBTree: creating empty db #{name}" if @@bot_registries.key? name |