Module: Flamethrower::Connection
Constant Summary
Constants included
from Irc::Codes
Irc::Codes::ERR_BADCHANNELKEY, Irc::Codes::ERR_UNKNOWNCOMMAND, Irc::Codes::RPL_CHANNELMODEIS, Irc::Codes::RPL_ENDOFMOTD, Irc::Codes::RPL_ENDOFNAMES, Irc::Codes::RPL_ENDOFWHO, Irc::Codes::RPL_MOTD, Irc::Codes::RPL_MOTDSTART, Irc::Codes::RPL_NAMEREPLY, Irc::Codes::RPL_NOWAWAY, Irc::Codes::RPL_TOPIC, Irc::Codes::RPL_UMODEIS, Irc::Codes::RPL_UNAWAY, Irc::Codes::RPL_WHOREPLY, Irc::Codes::RPL_WLCM
Instance Attribute Summary collapse
Instance Method Summary
collapse
#error, #reply, #send_channel_list, #send_channel_mode, #send_join, #send_motd, #send_nowaway, #send_part, #send_pong, #send_rename, #send_topic, #send_unaway, #send_user_mode, #send_userlist, #send_welcome, #send_who
Instance Attribute Details
#campfire_connection ⇒ Object
Returns the value of attribute campfire_connection.
5
6
7
|
# File 'lib/flamethrower/connection.rb', line 5
def campfire_connection
@campfire_connection
end
|
#current_user ⇒ Object
Returns the value of attribute current_user.
5
6
7
|
# File 'lib/flamethrower/connection.rb', line 5
def current_user
@current_user
end
|
#dispatcher ⇒ Object
Returns the value of attribute dispatcher.
5
6
7
|
# File 'lib/flamethrower/connection.rb', line 5
def dispatcher
@dispatcher
end
|
#irc_channels ⇒ Object
Returns the value of attribute irc_channels.
5
6
7
|
# File 'lib/flamethrower/connection.rb', line 5
def irc_channels
@irc_channels
end
|
Instance Method Details
#after_connect ⇒ Object
13
14
15
16
17
18
|
# File 'lib/flamethrower/connection.rb', line 13
def after_connect
send_welcome
send_motd
populate_irc_channels
populate_my_user
end
|
#initialize(options = {}) ⇒ Object
#populate_irc_channels ⇒ Object
39
40
41
|
# File 'lib/flamethrower/connection.rb', line 39
def populate_irc_channels
campfire_connection.fetch_rooms
end
|
#populate_my_user ⇒ Object
43
44
45
|
# File 'lib/flamethrower/connection.rb', line 43
def populate_my_user
campfire_connection.fetch_my_user
end
|
#receive_data(msg) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/flamethrower/connection.rb', line 26
def receive_data(msg)
@data ||= ::BufferedTokenizer.new("\r\n")
@data.(msg).each do |message|
::FLAMETHROWER_LOGGER.debug "<< #{message}"
dispatcher.handle_message(Flamethrower::Irc::Message.new(message))
end
end
|
#send_message(msg) ⇒ Object
20
21
22
23
24
|
# File 'lib/flamethrower/connection.rb', line 20
def send_message(msg)
send_data "#{msg}\r\n"
::FLAMETHROWER_LOGGER.debug ">> #{msg}"
msg
end
|
#send_messages(*messages) {|messages| ... } ⇒ Object
34
35
36
37
|
# File 'lib/flamethrower/connection.rb', line 34
def send_messages(*messages)
yield(messages) if block_given?
messages.each {|msg| send_message(msg)}
end
|