ft_irc is a simplified IRC (Internet Relay Chat) server implemented in C++. The project aims to explore network programming, socket communication, and server/client architecture.
The primary goal of ft_irc is to provide a functional IRC server that allows multiple users to connect, join channels, and exchange messages in real time — all while adhering to a subset of the RFC 1459 specification. It emphasizes the use of low-level socket programming and an event-driven architecture without relying on high-level frameworks or external libraries.
This project was developed in C++ as part of the 42 common core. It is fully compatible with official IRC clients such as WeeChat, Irssi, and Halloy. We used Irssi and Halloy as our reference clients.
ft_irc supports a range of core IRC functionalities, allowing users to communicate and manage channels effectively. Key features include:
✅ Channel Management
- Create or join channels dynamically
- Set or view channel topics
- Invite users to private channels
- Kick users from channels
💬 Messaging
- Send private messages (PRIVMSG) to users or channels
- Channel message caching for forwarding to newly joined users
🛡️ Channel Modes
The server supports common IRC modes with + / - syntax:
- o – Operator privileges
- l – Channel user limit
- k – Password-protected channels
- t – Topic protection (only ops can change)
- i – Invite-only channels
🔐 User Management
- Nickname and user setup
- Password authentication
- RFC-compliant server responses
🤖 Extras
- Built-in censorship bot for filtering specific words
- Base64 file transfer support between users
- Linux distro
- GCC or Clang
- Make
Clone the repository:
git clone https://github.com/itsYakub/42-ft_irc
cd ft_irc
Build the project:
make
Run ft_irc with a valid port and password:
./ircserv <port> <password>
Connect to the server via your chosen client and authenticate with NICK USER & PASS commands. The server logs all incoming messages and events. Now you can chat!
The internal design of ft_irc follows a modular and event-driven architecture, built around non-blocking I/O using the poll() system call. The server handles multiple client connections simultaneously and processes IRC commands using a command parser-dispatch system.
The core components include:
Initializes sockets, accepts new connections, and drives the main poll loop. It manages the overall lifecycle and communication flow between clients and channels.
Represents a connected user. Stores nickname, connection state, buffer data, and authentication status.
Manages a single IRC channel. Tracks users, operators, topic, modes, and internal cache for message forwarding.
Parses and executes IRC commands (JOIN, PRIVMSG, MODE, etc.). Delegates logic to relevant channel or client objects and ensures RFC-compliant responses.
-
Bot Module: Monitors messages and filters content based on the configured banned words.
-
Cache System: Stores channel messages for new clients joining mid-conversation.
-
File Transfer Handler: Supports base64-encoded file sending in a user → server → user chain.
Note: This diagram illustrates the high-level relationships between components and the flow of data within the server.
-
The server gracefully handles SIGINT, triggering a clean shutdown that removes cache files and frees all dynamically allocated memory.
-
Channel message caches are stored in corresponding files for temporary persistence.
-
Banned words for the censorship bot can be configured by editing the file located at:
./config/banned.txt
👀 If you notice any bugs, feel free to fork the repository & submit a pull request!
📢 If you're a 42 student, use this as a guide at most. Don't cheat, learn! <3
📅 Created in June 2025 as part of 42's Common Core at 42 Warsaw
This project is licensed under the MIT License. See LICENSE for details.