Class: Percy::Connection
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Percy::Connection
- Includes:
- EventMachine::Protocols::LineText2
- Defined in:
- lib/percy/connection.rb
Instance Method Summary collapse
Instance Method Details
#connection_completed ⇒ Object
8 9 10 11 12 |
# File 'lib/percy/connection.rb', line 8 def connection_completed IRC.raw "NICK #{IRC.config.nick}" IRC.raw "USER #{IRC.config.nick} 0 * :#{IRC.config.username}" IRC.raw "PASS #{IRC.config.password}" if IRC.config.password end |
#receive_line(line) ⇒ Object
31 32 33 |
# File 'lib/percy/connection.rb', line 31 def receive_line(line) IRC.parse line end |
#unbind ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/percy/connection.rb', line 14 def unbind IRC.connected = false IRC.traffic_logger.info('-- Percy disconnected') if IRC.traffic_logger puts "#{Time.now.strftime('%d.%m.%Y %H:%M:%S')} -- Percy disconnected" if IRC.config.reconnect IRC.traffic_logger.info("-- Reconnecting in #{IRC.config.reconnect_interval} seconds") if IRC.traffic_logger puts "#{Time.now.strftime('%d.%m.%Y %H:%M:%S')} -- Reconnecting in #{IRC.config.reconnect_interval} seconds" EventMachine::add_timer(IRC.config.reconnect_interval) do reconnect IRC.config.server, IRC.config.port end else EventMachine::stop_event_loop end end |