Class: IRC::Commands::QuitCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/irc/commands/quit_command.rb

Overview

4.1.6 Quit

Command: QUIT Parameters: [<Quit message>]

A client session is ended with a quit message. The server must close the connection to a client which sends a QUIT message. If a “Quit Message” is given, this will be sent instead of the default message, the nickname.

When netsplits (disconnecting of two servers) occur, the quit message is composed of the names of two servers involved, separated by a space. The first name is that of the server which is still connected and the second name is that of the server that has become disconnected.

If, for some other reason, a client connection is closed without the client issuing a QUIT command (e.g. client dies and EOF occurs on socket), the server is required to fill in the quit message with some sort of message reflecting the nature of the event which caused it to happen.

Numeric Replies:

None.

Examples:

QUIT :Gone to have lunch ; Preferred message format.

Instance Attribute Summary collapse

Attributes inherited from Command

#response

Instance Method Summary collapse

Methods inherited from Command

#execute, #on_server_response, #to_s, #valid_response?, #wait

Methods included from IRC::Client::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_ping, #on_pong, #on_private_message, #on_registration, #on_registration_failure, #on_server_response, #on_welcome

Constructor Details

#initialize(message) ⇒ QuitCommand

Returns a new instance of QuitCommand.

Raises:



64
65
66
67
68
69
70
71
# File 'lib/irc/commands/quit_command.rb', line 64

def initialize(message)
  
  raise InvalidCommand.new("Can't create quit command. No quit message.") unless message
  @message = message
  
  super(command)      
          
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



62
63
64
# File 'lib/irc/commands/quit_command.rb', line 62

def message
  @message
end

Instance Method Details

#commandObject



73
74
75
# File 'lib/irc/commands/quit_command.rb', line 73

def command 
  return "QUIT :#{message}"
end