Module: Fargo::Supports::Chat

Extended by:
ActiveSupport::Concern
Included in:
Client
Defined in:
lib/fargo/supports/chat.rb

Instance Method Summary collapse

Instance Method Details

#messagesObject



10
11
12
# File 'lib/fargo/supports/chat.rb', line 10

def messages
  @public_chats
end

#messages_with(nick) ⇒ Object



14
15
16
# File 'lib/fargo/supports/chat.rb', line 14

def messages_with nick
  @chats[nick] if @chats
end

#subscribe_to_chatsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fargo/supports/chat.rb', line 18

def subscribe_to_chats
  @public_chats = []
  @chats = Hash.new{ |h, k| h[k] = [] }

  subscribe do |type, map|
    if type == :chat
      @public_chats << map
    elsif type == :privmsg
      @chats[map[:from]] << map
    elsif type == :hub_disconnected
      @chats.clear
      @public_chats.clear
    end
  end
end