This project has been created as part of the 42 curriculum by iarefeva, mmravec.
This project is a custom IRC (Internet Relay Chat) server developed as part of the 42 curriculum.
Project was developed based on Weechat client, but other clients working with IRC protocol can be used. Server accepts allowing multiple users to join channels and exchange messages in real-time.
- Multi-client handling
- User authentication (PASS, NICK, USER)
- Channel management:
- JOIN / PART
- TOPIC
- INVITE
- KICK
- Channel operator
- Private messaging (PRIVMSG)
- Channel modes (oklit)
- Graceful client disconnection
- DCC File Transfer (Direct Client-to-Client)
Supports sending files between users using DCC
Implemented via direct TCP connection between clients
β οΈ Currently works only within the same local network (LAN) - IRC Bot
ft_irc/
βββ bot/ # Bonus files for bot
βββ inc/ # Mandatory header files
βββ src/ # Mandatory source files
βββ unit_tests/ # Unit_tests
βββ Makefile
βββ README.md
Clone the repository and compile using make:
git clone <link to the repo> ft_irc
cd ft_irc
makeThis will generate the executable:
./ircservRun the server with:
./ircserv <port> <password>Example:
./ircserv 6667 mypasswordThere will be described connection through WeeChat, but you can use any IRC client such as:
- nc (netcat)
- HexChat
- WeeChat
- irssii
In WeeChat window, first add server:
/server add <name> <server IP>/6667 (or other port)
Second add password to the server:
/set irc.server.<name>.password <password>
Third connect to the server:
/connect <name>
All commands for connection WeeChat will send automaticaly.
- Multi-client handling
- User authentication (PASS, NICK, USER)
- Channel management:
- JOIN / PART
- TOPIC
- INVITE
- KICK
- Operator commands
- Private messaging (PRIVMSG)
- Channel modes (depending on implementation)
- Graceful client disconnection
Client 1: JOIN #42
Client 2: JOIN #42
Client 1: PRIVMSG #42 :Hello from 42!
Expected behavior: Both clients receive the message in real time.
This project also includes a simple IRC bot called MrBot. It connects to our IRC server and responds to basic commands.
make bonus
This will generate the executable:
./ircbot
Run the bot with:
./ircbot <IP> <port> <password>
Example:
./ircbot 127.0.0.1 6667 mypassword
β IP address of your IRC server β Port used by the server β Server password (PASS command)
After launching, the bot will:
- Connect to the IRC server
- Authenticate using:
- PASS
- NICK (MrBot)
- USER - Listen for incoming messages
- Respond to commands automatically
You can interact with the bot via private messages:
!joke - Returns a random joke
!help - Displays help information
User: PRIVMSG MrBot :!joke
MrBot: Why do programmers prefer dark mode? Because light attracts bugs.
User: PRIVMSG MrBot :!help
MrBot: Hi, I am MrBot! Available commands: !joke, !help
Press Ctrl + C to gracefully terminate the bot.
The bot currently handles:
- PRIVMSG (commands)
- PING (keeps connection alive)
The bot does not automatically join channels (can be extended)
Make sure the server is running
This project supports DCC (Direct Client-to-Client) file transfer, allowing users to send files directly to each other.
Both users must be connected to the IRC server
Both users must use a client that supports DCC (e.g., WeeChat)
π€ Sending a File (WeeChat)
In WeeChat, use:
/dcc send <nickname> <file_path>
Example:
/dcc send user2 ./example.txt
When another user sends you a file, WeeChat will display a notification.
To accept the file:
/dcc accept <nickname>
Received files are usually saved in:
~/weechat/dcc/
You can change this path in WeeChat settings.
DCC uses a direct TCP connection between clients, not the server
Firewalls or NAT may block transfers
This implementation currently:
- May not work over the internet without port forwarding
- Make sure the receiving client allows incoming DCC connections
User1: /dcc send user2 ./file.txt
User2: (receives notification)
User2: /dcc accept user1
Result: file.txt is transferred directly from User1 to User2.
RFC 1459 β Internet Relay Chat Protocol
RFC 2812 β IRC Client Protocol
Beejβs Guide to Network Programming
Linux poll / select man pages
AI tools (such as ChatGPT, Clode) were used in this project for:
Clarifying IRC protocol behavior and edge cases
Understanding socket programming concepts
Debugging specific issues
Improving code structure and readability
Assisting in writing documentation (including this README)
All implementation decisions, architecture, and final code were designed and validated by the authors.
Full support of all IRC modes
Better scalability (epoll/kqueue)
Logging system
TLS/SSL support