Class: IRC::Commands::PasswordCommand
- Defined in:
- lib/irc/commands/password_command.rb
Overview
4.1.1 Password message
Command: PASS Parameters: <password>
The PASS command is used to set a ‘connection password’. The password can and must be set before any attempt to register the connection is made. Currently this requires that clients send a PASS command before sending the NICK/USER combination and servers must send a PASS command before any SERVER command. The password supplied must match the one contained in the C/N lines (for servers) or I lines (for clients). It is possible to send multiple PASS commands before registering but only the last one sent is used for verification and it may not be changed once registered.
Numeric Replies:
ERR_NEEDMOREPARAMS ERR_ALREADYREGISTRED
Example:
PASS secretpasswordhere
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Attributes inherited from Command
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(password) ⇒ PasswordCommand
constructor
A new instance of PasswordCommand.
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(password) ⇒ PasswordCommand
Returns a new instance of PasswordCommand.
59 60 61 62 63 |
# File 'lib/irc/commands/password_command.rb', line 59 def initialize(password) raise InvalidCommand.new("Can't create password command. No password.") unless password @password = password super(command) end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
57 58 59 |
# File 'lib/irc/commands/password_command.rb', line 57 def password @password end |
Instance Method Details
#command ⇒ Object
65 66 67 |
# File 'lib/irc/commands/password_command.rb', line 65 def command return "PASS #{password}" end |