This project has been created as part of the 42 curriculum by mrosset, llabatut, cyglardo.
The ft_irc projects consists of creating a server that can be used by an IRC client.
Basically, the task is to develop a programm that allows to exchange public and private messages by creating and managing users and channels on an already existing IRC client, using the TCP/IP protocol to communicate with it.
Several things are needed in order to accomplish this:
- Understanding the TCP/IP protocol.
- Understanding how to use sockets.
- Parsing the commands.
Copy the link of the repository. You can find it by clicking on the green button labelled "<>Code" at the top of the page.
In your terminal, choose the location where you want to install ft_irc, then type:
git clone pasteTheLinkYouCopied
Paste the link and press enter.
In your terminal, go in the cloned repository and type:
make
Press enter. If everything worked, a new file should have been created, named "ft_irc". Execute it with a port and password (example given in the "configuration.txt" file), like this:
./ircserv port password
Press enter. The server should now be running. Open the IRC client and connect it to your server using its name, its port and its password.
Once installed, launch it with
weechat
Then, add the server with
/server add ircserv 0/6667
0 = the server's address 6667 = the suggested port
Then, configure the server with
/set irc.server.ircserv.password password
/save
password = the server's password
Then, connect to the server with
/connect ircserv
If the connection is successful, you can now use the client as if it was connected to any official server.
To test it thoroughly, open multiple clients and connect them all to the server. Every client should work normally and act as different users.
To launch another client, use:
weechat --dir <newclientname>
- authenticate
/pass password - set a nickname
/nick nickname - set a username
/user username - join a channel
/join #channel - write a private message to an other user (client)
/msg nickname1,nickname2,#channel message - kick a user (client) from a channel
/kick nickname #channel - invite a user (client) to a channel
/invite nickname #channel - change and view the channel topic
/topic #channel newTopic - change the channel's parameters (mode):
- set / remove the access to the channel (open / invite only)
/mode [+/-]i #channel - set / remove the restrictions on the command allowing to change or view the channel topic
/mode [+/-]t nickname #channel - set / remove the channel's password (key)
/mode [+/-]k password #channel - give / take owner (operator) privilege
/mode [+/-]o nickname #channel - set / remove user limit
/mode [+/-]l numberlimit #channel
- set / remove the access to the channel (open / invite only)
Several websites were used to understand the different technical aspects of the project.
General informations:
- https://medium.com/@mohcin.ghalmi/irc-server-internet-relay-chat-bd08e4f469f8
- https://www.geeksforgeeks.org/operating-systems/i-o-scheduling-in-operating-systems/
The poll() function:
- https://man7.org/linux/man-pages/man2/poll.2.html
- https://www.ibm.com/docs/en/i/7.4.0?topic=ssw_ibm_i_74/apis/poll.htm
Choosing an IRC client:
- https://libera.chat/guides/clients
- https://weechat.org/files/doc/weechat/stable/weechat_quickstart.fr.html
Understanding how the IRC client works:
- https://datatracker.ietf.org/doc/html/rfc1459
- https://docs.redhat.com/en/documentation/red_hat_fuse/7.3/html/connecting_fuse_online_to_applications_and_services/connecting-to-irc_connectors
- the weechat-fr buffer of the libera server
Understanding the replies to send:
Understanding the sockets:
Understanding the packets:
AI :
- AI was used in this project as an educational support to better understand concepts and clarify technical documentation, or for more detailed explanations.