]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/core/journal.rb
journal: introduce ensure_payload_index
[user/henk/code/ruby/rbot.git] / lib / rbot / core / journal.rb
index f8a886202a2167e1fa39baaf1eff695e6b848411..c4f5f0f453a01fa7cf97c32bcbbef641aed71643 100644 (file)
@@ -7,6 +7,17 @@
 
 require 'rbot/journal'
 
+module ::Irc
+class Bot
+  # this should return the journal if the managing plugin has been loaded.
+  def journal
+    if @plugins['journal']
+      @plugins['journal'].broker
+    end
+  end
+end
+end
+
 class JournalModule < CoreBotModule
 
   attr_reader :broker
@@ -28,7 +39,13 @@ class JournalModule < CoreBotModule
     name = @bot.config['journal.storage']
     uri = @bot.config['journal.storage.uri']
     if name
-      storage = Storage.create(name, uri)
+      begin
+        storage = Storage.create(name, uri)
+      rescue
+        error 'journal storage initialization error!'
+        error $!
+        error $@.join("\n")
+      end
     end
     debug 'journal broker starting up...'
     @broker = JournalBroker.new(storage: storage)