Module: Lijab::HistoryHandler

Defined in:
lib/lijab/history.rb

Defined Under Namespace

Classes: DummyHistory, History

Class Method Summary collapse

Class Method Details

.get(jid) ⇒ Object



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.[:log]
      path = File.join(Config.[:log_dir], "#{name}.log")
      @histories[name] ||= History.new(path, name, true)
   else
      @dummy ||= DummyHistory.new
   end
end

.init_session_logObject



114
115
116
117
118
# File 'lib/lijab/history.rb', line 114

def init_session_log
   return unless Config.[:log]

   @session = History.new(path = File.join(Config.[:log_dir], "session.log"))
end

.last(n) ⇒ Object



104
105
106
107
108
109
110
111
112
# File 'lib/lijab/history.rb', line 104

def last(n)
   unless Config.[:log]
      Out::put("warning: logs are disabled")
      return []
   end

   init_session_log() unless @session
   @session.last(n)
end

.log(msg, direction, target) ⇒ Object



97
98
99
100
101
102
# File 'lib/lijab/history.rb', line 97

def log(msg, direction, target)
   return unless Config.[:log]

   init_session_log() unless @session
   @session.log(msg, direction, target)
end