Skip to content

IRC Protocol

i99dev edited this page Jan 10, 2023 · 10 revisions

Content Table

Server-Client communication

Commands


Command Name: JOIN

Description

The JOIN command is used to request to join a specific channel on the IRC server. The channel may be specified by its name or by its channel key, if one is set. If the channel does not exist, the server will create it.

Syntax

JOIN <channel> [<key>]

channel: The name of the channel to join. This can be a combination of letters, digits, and special characters, but must not begin with a digit or special character. key: (Optional) The channel key or password, if one is set for the channel. Examples

JOIN #example

This will join the channel named #example. If the channel does not exist, it will be created.

JOIN #example secretkey

This will join the channel #example, but only if the correct key or password (secretkey) is provided.

Notes

Some channels may be restricted and require an invitation or special privileges to join. The channel name must be prefixed with a # symbol. If the channel key is not provided when joining a password-protected channel, the server will return an error.


Command Name: USER

Description

The USER command is used to set the user information for the client connecting to the IRC server. This includes the user's username, hostname, and real name.

Syntax

USER <username> <hostname> <servername> <realname>

username: The user's username. hostname: The user's hostname or the name of the client's host machine. servername: The name of the server the user is connected to. realname: The user's real name or "gecos".

USER jane example.com irc.example.com Jane Doe

This sets the user's username to jane, hostname to example.com, servername to irc.example.com, and real name to Jane Doe.

Notes

The USER command must be sent before the NICK command in order to properly register with the server. The servername and hostname fields are not used by all servers and may be ignored. The real name field is typically used to display the user's full name or other personal information.


Command Name: NICK

Description

The NICK command is used to set or change the client's nickname on the IRC server. The nickname is a unique identifier that is used to represent the client in channels and for private messaging.

Syntax

NICK <nickname>

nickname: The new nickname for the client. This can be a combination of letters, digits, and special characters, but must not begin with a digit or special character. Examples

NICK jane

This sets the client's nickname to jane.

NICK jane_doe

This changes the client's nickname to jane_doe.

Notes

The NICK command must be sent after the USER command in order to properly register with the server. If the desired nickname is already in use by another client, the server will return an error and the client must choose a different nickname. Some servers may have restrictions on the length or format of nicknames.


Command Name: KICK

Description

The KICK command is used by operators to forcibly remove a user from a channel. This can be used as a means of punishment or to remove disruptive users from a channel.

Syntax

KICK <channel> <user> [<reason>]

channel: The name of the channel from which the user will be removed. user: The nickname of the user to be removed. reason: (Optional) A message explaining the reason for the kick.

KICK #example jane

This kicks the user jane from the channel #example.

KICK #example jane spamming

This kicks the user jane from the channel #example for the reason "spamming".

Notes

Only operators or users with special privileges can use the KICK command. If the specified channel or user does not exist, the server will return an error. The KICK command may not be allowed on all channels, depending on the channel's mode or settings.


Command Name: WHOIS

Description

The WHOIS command is used to request information about a specific user on the IRC server. This includes the user's nickname, username, hostname, and any channels they are currently in.

Syntax

WHOIS <user>

user: The nickname of the user to request information about.

WHOIS jane

This requests information about the user jane.

Notes

The server will return a response with the requested information about the user. If the specified user does not exist, the server will return an error. Some servers may also return additional information about the user, such as their real name or server of origin.


Command Name: CAP

Description

The CAP command is used to request or acknowledge capabilities supported by the server or client. Capabilities are additional features or extensions to the IRC protocol that may be supported by the server or client.

Syntax

CAP <subcommand> [<capability>] [<parameters>]

subcommand: The subcommand for the CAP command. This can be one of LS, REQ, ACK, NAK, or CLEAR. capability: (Optional) The name of the capability to request or acknowledge. parameters: (Optional) Additional parameters or options for the capability.

CAP LS

This requests a list of capabilities supported by the server.

CAP REQ :multi-prefix

This requests the multi-prefix capability from the server.

CAP ACK :multi-prefix

This acknowledges that the client supports the multi-prefix capability.

Notes

The CAP command is used to negotiate and exchange capabilities between the client and server. Not all servers or clients may support the same set of capabilities. The LS, REQ, and ACK subcommands can be used by the client to request or acknowledge capabilities. The NAK and CLEAR subcommands can be used by the server to reject or reset capability negotiations.


Command Name: MODE

Description

The MODE command is used to set or request the mode of a channel or user on the IRC server. Modes can be used to change the behavior or settings of a channel or user, such as setting channel privileges or banning users.

Syntax

MODE <target> <mode> [<parameters>]

target: The name of the channel or user to set the mode for. mode: The mode to set or request. This can be a combination of mode characters and parameters, such as +o or +b nick!user@host. parameters: (Optional) Additional parameters or options for the mode.

MODE #example +o jane

This sets operator mode for the user jane in the channel #example.

MODE #example +b nick!user@host

This sets a ban for the user nick!user@host in the channel #example.

MODE jane +i

This sets invisible mode for the user jane.

Notes

Only operators or users with special privileges can set modes on a channel. The available modes and their parameters may vary depending on the server or client. The MODE command can also be used to request the current mode of a channel or user.

Messages

Parser

Partial data

Replies

Clone this wiki locally