This project is an implementation of an IRC (Internet Relay Chat) server in C++. It allows multiple clients to connect, communicate in channels, and execute various IRC commands.
- Socket Programming: Uses sockets and epoll for handling multiple clients simultaneously.
- Client Authentication: Clients authenticate using a password, username, and nickname.
- Channel Management: Clients can create, join, leave, and manage channels.
- IRC Commands: Supports commands like
JOIN,NICK,PRIVMSG,KICK,TOPIC, and more. - Bot Functionality: Includes a bot that provides jokes, the current date, and the number of connected clients.
Server(Server.hpp,Server.cpp): Manages client connections, channels, and command handling.Client(Client.hpp,Client.cpp): Represents a connected user and manages their state.Channel(Channel.hpp,Channel.cpp): Represents an IRC channel and manages its members, operators, and modes.IRCCommandHandler(IRCCommandHandler.hpp,IRCCommandHandler.cpp): Processes and executes IRC commands.- Commands (
src/commands/): Implements individual IRC commands likeJOIN,NICK,PRIVMSG, etc. - Utilities (
Utilities.hpp,Utilities.cpp): Provides helper functions like string manipulation.
| Command | Description |
|---|---|
PASS |
Authenticate the client with a password. |
NICK |
Set or change the client's nickname. |
USER |
Set the client's username. |
JOIN |
Join a channel or create one if it doesn't exist. |
PART |
Leave a channel. |
PRIVMSG |
Send a private message to a user or channel. |
TOPIC |
Get or set the topic of a channel. |
KICK |
Remove a user from a channel. |
MODE |
Manage channel modes (e.g., invite-only, topic-protected). |
INVITE |
Invite a user to a channel. |
WHO |
List users in a channel. |
QUIT |
Disconnect from the server. |
BOT |
Interact with the bot (JOKE, DATE, CLIENTS). |
Compile the project using the Makefile:
makeStart the server with a port and password:
./ircserv <port> <password>You can connect to the server using an IRC client like netcat, irssi, or a custom client.
Example using netcat:
nc localhost <port>Authenticate the client:
PASS <password>
USER <username> 0 * <realname>
NICK <nickname>
-
Start the server:
./ircserv 6667 default
-
Connect a client using
netcat:nc localhost 6667
-
Authenticate the client:
PASS default USER myuser 0 0 0 NICK mynick -
Join a channel:
JOIN #mychannel -
Send a message:
PRIVMSG #mychannel :Hello, world! -
Use the bot:
BOT JOKE
| Command | Description |
|---|---|
JOKE |
Sends a random joke. |
DATE |
Sends the current date and time. |
CLIENTS |
Sends the number of connected clients. |