102 lines
3.4 KiB
Markdown
102 lines
3.4 KiB
Markdown
*This project has been created as part of the 42 curriculum by lfirmin, jle-neze.*
|
|
|
|
## Description
|
|
|
|
ft_irc is an IRC server written in C++ 98. It allows multiple clients to connect simultaneously, authenticate, join channels, and communicate in real time using the IRC protocol over TCP/IP. The server is built around a single `poll()` call with non-blocking I/O, handling all connections without forking.
|
|
|
|
## Instructions
|
|
|
|
### Compilation
|
|
|
|
```
|
|
make
|
|
```
|
|
|
|
### Execution
|
|
|
|
```
|
|
./ircserv <port> <password>
|
|
```
|
|
|
|
- `port` : the port the server listens on (e.g. 6667)
|
|
- `password` : the connection password required by IRC clients
|
|
|
|
### Connecting with irssi
|
|
|
|
```
|
|
irssi
|
|
/connect localhost <port> <password>
|
|
```
|
|
|
|
### Connecting with netcat (for testing)
|
|
|
|
```
|
|
nc -C localhost <port>
|
|
```
|
|
|
|
Then send commands manually:
|
|
```
|
|
PASS <password>
|
|
NICK <nickname>
|
|
USER <username> 0 * :<realname>
|
|
JOIN #<channel>
|
|
PRIVMSG #<channel> :<message>
|
|
```
|
|
|
|
## Available Commands
|
|
|
|
### Registration
|
|
|
|
| Command | Usage | Description |
|
|
|---------|-------|-------------|
|
|
| `PASS` | `PASS <password>` | Authenticate with the server password |
|
|
| `NICK` | `NICK <nickname>` | Set or change your nickname |
|
|
| `USER` | `USER <username> 0 * :<realname>` | Set your username and realname |
|
|
| `QUIT` | `QUIT` | Disconnect from the server |
|
|
| `PING` | `PING <token>` | Ping the server, replies with PONG |
|
|
|
|
### Channels
|
|
|
|
| Command | Usage | Description |
|
|
|---------|-------|-------------|
|
|
| `JOIN` | `JOIN #<channel> [key]` | Join or create a channel |
|
|
| `PART` | `PART #<channel>` | Leave a channel |
|
|
| `PRIVMSG` | `PRIVMSG #<channel> :<message>` | Send a message to a channel |
|
|
| `PRIVMSG` | `PRIVMSG <nick> :<message>` | Send a private message to a user |
|
|
|
|
### Operator Commands
|
|
|
|
| Command | Usage | Description |
|
|
|---------|-------|-------------|
|
|
| `KICK` | `KICK #<channel> <nick>` | Eject a user from the channel |
|
|
| `INVITE` | `INVITE <nick> #<channel>` | Invite a user to the channel |
|
|
| `TOPIC` | `TOPIC #<channel>` | View the channel topic |
|
|
| `TOPIC` | `TOPIC #<channel> :<topic>` | Change the channel topic |
|
|
| `MODE` | `MODE #<channel> +i` | Set channel invite-only |
|
|
| `MODE` | `MODE #<channel> -i` | Remove invite-only |
|
|
| `MODE` | `MODE #<channel> +t` | Restrict TOPIC to operators |
|
|
| `MODE` | `MODE #<channel> -t` | Remove TOPIC restriction |
|
|
| `MODE` | `MODE #<channel> +k <key>` | Set a channel password |
|
|
| `MODE` | `MODE #<channel> -k` | Remove the channel password |
|
|
| `MODE` | `MODE #<channel> +o <nick>` | Give operator privilege to a user |
|
|
| `MODE` | `MODE #<channel> -o <nick>` | Remove operator privilege from a user |
|
|
| `MODE` | `MODE #<channel> +l <limit>` | Set a user limit on the channel |
|
|
| `MODE` | `MODE #<channel> -l` | Remove the user limit |
|
|
|
|
## Resources
|
|
|
|
- [RFC 1459 - IRC Protocol](https://datatracker.ietf.org/doc/html/rfc1459)
|
|
- [RFC 2812 - IRC Client Protocol](https://datatracker.ietf.org/doc/html/rfc2812)
|
|
- [Beej's Guide to Network Programming](https://beej.us/guide/bgnet/)
|
|
- [irssi documentation](https://irssi.org/documentation/)
|
|
|
|
### AI Usage
|
|
|
|
Claude (claude.ai) was used during this project to:
|
|
- Guide the step-by-step implementation of the Server class (socket setup, poll loop, client handling)
|
|
- Explain IRC protocol concepts and numeric error codes
|
|
- Help structure the Channel class and its methods
|
|
- Debug compilation errors and logic issues
|
|
|
|
All generated content was reviewed, understood and typed manually by the authors before being integrated into the project.
|