Class: HistoryPlugin

Inherits:
Campfire::PollingBot::Plugin show all
Defined in:
lib/campfire/polling_bot/plugins/history/history_plugin.rb

Overview

records every message the bot receives

Constant Summary

Constants inherited from Campfire::PollingBot::Plugin

Campfire::PollingBot::Plugin::HALT

Instance Attribute Summary

Attributes inherited from Campfire::PollingBot::Plugin

#bot, #config

Instance Method Summary collapse

Methods inherited from Campfire::PollingBot::Plugin

accepts, #accepts?, accepts?, bot, bot=, directory, directory=, inherited, #initialize, load_all, load_plugin_classes, #logger, logger, priority, #priority, requires_config, requires_config?, #requires_config?, setup_database, subclasses, #to_s

Constructor Details

This class inherits a constructor from Campfire::PollingBot::Plugin

Instance Method Details

#process(message) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/campfire/polling_bot/plugins/history/history_plugin.rb', line 6

def process(message)
  @room_locked ||= false
  if message.kind_of?(Campfire::LockMessage)
    @room_locked = true
    return
  elsif message.kind_of?(Campfire::UnlockMessage)
    @room_locked = false
    return
  end

  save_message(message) unless @room_locked
end