From 763a7f968063fa993bb63f7b31ad69f73212c53b Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Wed, 24 Jun 2015 19:19:07 +0000 Subject: [PATCH] journal: move journal accessor in coremodule --- lib/rbot/core/journal.rb | 11 +++++++++++ lib/rbot/ircbot.rb | 7 ------- lib/rbot/journal.rb | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/rbot/core/journal.rb b/lib/rbot/core/journal.rb index 4bd4ec3c..c4f5f0f4 100644 --- a/lib/rbot/core/journal.rb +++ b/lib/rbot/core/journal.rb @@ -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 diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 46e4faaa..739aaade 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -226,13 +226,6 @@ class Bot myself.channels end - # returns the journal - def journal - if @plugins['journal'] - @plugins['journal'].broker - end - end - # nick wanted by the bot. This defaults to the irc.nick config value, # but may be overridden by a manual !nick command def wanted_nick diff --git a/lib/rbot/journal.rb b/lib/rbot/journal.rb index 9f586f7f..fe6c14be 100644 --- a/lib/rbot/journal.rb +++ b/lib/rbot/journal.rb @@ -278,6 +278,7 @@ module Journal class JournalBroker + attr_reader :storage class Subscription attr_reader :topic attr_reader :block -- 2.39.2