This project is about creating a small IRC server that can be used with a real IRC client to chat, create chat rooms, send private messages to one or multiple users, etc ...
We tested it with Netcat (TCP/UDP client) and IRSSI (IRC client)
Clone the project and launch make
to build the server executable :
git clone [email protected]:twagger/ft_irc.git
cd ft_irc
make
./ircserv [port number] [password]
For example
./ircserv 6667 my-password
nc -C 127.0.0.1 6667
note : we use the -C option because IRC messages end with \r\n as defined in the RFC 2812 standards.
note : We used 127.0.0.1 since our server is launched in localhost.
You need to authenticate to the server otherwise you will be deconnected quickly :
pass my-password
user tom 0 * :tom
nick tom
note : To understand more abour the authentification process please look here.
irssi
/connect 127.0.0.1 6667 my-password
note : The authentification process is automatically done by irssi.
note : Your user will be known in the server as plop.
We implemented a lot of command from the RFC 2812. We didn't implemented the multi server commands as it was not required in the project.
Category | Commands |
---|---|
Server | DIE, INFO, MOTD, PING, PONG, QUIT, SERVICES, TIME, VERSION |
User | USER, KILL, MODE (B, i, o, r, s), NICK, OPER, PASS, WHO, WHOIS |
Channel | INVITE, JOIN, KICK, LIST, MODE (b, i, k, o), NAMES, PART, TOPIC |
Private message | PRIVMSG, NOTICE |
We where asked to implement file transfer. If you are using a proper IRC client like IRSSI, you can use XDCC (eXtended DCC) which use direct messages to establish a direct connection between two clients so they can share files.
Sending file to another client
/dcc send [nickname of user] [path of the file between quotes]
Example
/dcc send plop_ "Documents/test.txt"
Receiving file from a client
/dcc get [nickname of user][name of the file between quotes]
example
/dcc get plop "test.text"
We implemented it as a simple client using the command services. This bot can be contacted by private message and answer to specific commands only :
- QUOTE : give the quote of the day
- TIME : give the exact time of the sercer
The bot is a second separate program that need to be launched and connected to server with a specific command :
./ircbot [hostname] [password]
Then the bot is available on the server and can interact with real users. It is a very simple bot but it could be enhanced a lot to be more useful. We just wanted to understand the concept here.
- RFC
- Channel related RFC
- Tutorial on how to implement a server in french
- Website made by 42 students from Paris
- 🖼️ Illustrative image from : here