This project is an implementation of an IRC server built in C++. It adheres to the basic principles of the IRC protocol, allowing multiple clients to connect, communicate in channels, and execute various commands such as joining channels, sending private messages, and setting topics. The project was created by idelibal and mortins-.
- User Authentication: Password-based authentication for clients.
- Channel Management: Create, join, and manage channels with features like invite-only, user limits, and channel keys.
- Messaging: Support for private messages and broadcast messages within channels.
- Server Administration: Operators can manage channels and users with commands like
KICK
andINVITE
. - Command Support: Implements key IRC commands such as
PASS
,NICK
,USER
,JOIN
,PRIVMSG
,MODE
,TOPIC
,QUIT
, and more. - Signal Handling: Gracefully handles server shutdown via signals like
SIGINT
andSIGQUIT
.
- A C++ compiler supporting C++98.
- Basic understanding of networking and the IRC protocol.
- Clone the repository:
git clone https://github.com/dlbltv/ft_irc.git cd ft_irc
- Compile the project:
make
Run the server executable with the following syntax:
./ircserv <port> <password>
<port>
: The port number on which the server will listen.<password>
: The password required for clients to authenticate.
Example:
./ircserv 6987 my_secure_password
Clients can connect to the server using any standard IRC client (e.g., HexChat, irssi). They must use the password specified during the server launch.
NetCat (nc) can also be used to test the server. Here is an example:
- Start the server:
./ircserv 6987 my_secure_password
- Open a terminal and connect using NetCat:
nc localhost 6667
- Authenticate with the server by typing the following commands in the NetCat session:
PASS my_secure_password
NICK mynickname
USER myusername 0 * :My Real Name
- Once authenticated, you can use other IRC commands like:
JOIN #mychannel
PRIVMSG #mychannel :Hello, World!
QUIT :Goodbye
main.cpp
: Entry point of the server, handling initial setup and signal handling.Server.cpp
: Core server logic, including socket creation, client management, and command parsing.Client.cpp
: Represents a connected client with methods for managing their state.Channel.cpp
: Represents an IRC channel, including membership and modes.Commands.cpp
: Implementation of IRC commands.- Makefile: For building the project.
Command | Description |
---|---|
PASS |
Authenticates a client using the server password. |
NICK |
Sets the client's nickname. |
USER |
Sets the client's username and other details. |
JOIN |
Joins a client to a channel. |
PRIVMSG |
Sends a private message to a user or channel. |
TOPIC |
Sets or retrieves the topic of a channel. |
QUIT |
Disconnects a client from the server. |
HELP |
Provides information on available commands. |
KICK |
Removes a client from a channel. |
INVITE |
Invites a user to join a channel. |
LIST |
Lists all channels or details of a specific channel. |
NAMES |
Lists all users in a channel. |
MODE |
Sets or removes channel/user modes. |
DIE |
Shuts down the server (operator command). |
Special thanks to the 42 Network for fostering collaboration and learning.