Class: IRC::Client::ConnectionState

Inherits:
Object
  • Object
show all
Includes:
ConnectionListener, Singleton
Defined in:
lib/irc/client/connection_state.rb

Direct Known Subclasses

ConnectedState, DisconnectedState

Instance Method Summary collapse

Methods included from ConnectionListener

#on_connect, #on_disconnect, #on_error, #on_join, #on_join_failure, #on_kick, #on_nick, #on_nick_already_in_use, #on_notice, #on_part, #on_part_failure, #on_pong, #on_private_message, #on_registration, #on_registration_failure, #on_server_response

Instance Method Details

#change_nick(context, nick) ⇒ Object

Changes the nick name.



39
40
# File 'lib/irc/client/connection_state.rb', line 39

def change_nick(context, nick)
end

#connect(context, server) ⇒ Object

Connects to the server.



43
44
# File 'lib/irc/client/connection_state.rb', line 43

def connect(context, server)
end

#disconnect(context, message = nil) ⇒ Object

Disconnects from the currently connected server.



47
48
# File 'lib/irc/client/connection_state.rb', line 47

def disconnect(context, message = nil)
end

#join(context, channels) ⇒ Object

Joins the given channels.



51
52
# File 'lib/irc/client/connection_state.rb', line 51

def join(context, channels)
end

#on_ping(context, servers) ⇒ Object

This method gets called when a ping message was received from the server.



79
80
81
# File 'lib/irc/client/connection_state.rb', line 79

def on_ping(context, servers)
  IRC::Commands::PongCommand.new(servers[0], servers[1]).execute(context)
end

#on_welcome(context, user, text) ⇒ Object

This method gets called when a welcome message was received.



84
85
86
# File 'lib/irc/client/connection_state.rb', line 84

def on_welcome(context, user, text)
  context.nick = user.nick
end

#part(context, channels) ⇒ Object

Leaves the given channels.



55
56
# File 'lib/irc/client/connection_state.rb', line 55

def part(context, channels)
end

#private_message(context, target, message) ⇒ Object

Sends a private message to the target (a nick or a channel).



59
60
# File 'lib/irc/client/connection_state.rb', line 59

def private_message(context, target, message)
end

#register(context, nick, login, realname) ⇒ Object

Register the connection by sending the password, nick and user commands.



63
64
# File 'lib/irc/client/connection_state.rb', line 63

def register(context, nick, , realname)
end

#send_command(context, command) ⇒ Object

Sends the command to the server bypassing the command queue.



67
68
69
# File 'lib/irc/client/connection_state.rb', line 67

def send_command(context, command)
  context.command_handler.send_command(command)      
end

#send_command_via_queue(context, command) ⇒ Object

Sends the command to the server using the command queue.



72
73
74
# File 'lib/irc/client/connection_state.rb', line 72

def send_command_via_queue(context, command)
  context.command_handler.send_command_via_queue(command)            
end