Module: Lijab::HistoryHandler
- Defined in:
- lib/lijab/history.rb
Defined Under Namespace
Classes: DummyHistory, History
Class Method Summary collapse
- .get(jid) ⇒ Object
- .init_session_log ⇒ Object
- .last(n) ⇒ Object
- .log(msg, direction, target) ⇒ Object
Class Method Details
permalink .get(jid) ⇒ Object
[View source]
87 88 89 90 91 92 93 94 95 |
# File 'lib/lijab/history.rb', line 87 def get(jid) name = jid.strip.to_s if Config.account[:log] path = File.join(Config.account[:log_dir], "#{name}.log") @histories[name] ||= History.new(path, name, true) else @dummy ||= DummyHistory.new end end |
permalink .init_session_log ⇒ Object
[View source]
114 115 116 117 118 |
# File 'lib/lijab/history.rb', line 114 def init_session_log return unless Config.account[:log] @session = History.new(path = File.join(Config.account[:log_dir], "session.log")) end |
permalink .last(n) ⇒ Object
[View source]
104 105 106 107 108 109 110 111 112 |
# File 'lib/lijab/history.rb', line 104 def last(n) unless Config.account[:log] Out::put("warning: logs are disabled") return [] end init_session_log() unless @session @session.last(n) end |
permalink .log(msg, direction, target) ⇒ Object
[View source]
97 98 99 100 101 102 |
# File 'lib/lijab/history.rb', line 97 def log(msg, direction, target) return unless Config.account[:log] init_session_log() unless @session @session.log(msg, direction, target) end |