Skip to content

The 12th project of 42's curriculum is about creating our own IRC server. An actual IRC client will be used to connect to the server and test it. Internet is ruled by solid standards protocols that allow connected computers to interact with each other. It’s always a good thing to know.

License

Notifications You must be signed in to change notification settings

ygor-sena/42cursus-ft-irc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS Language Grade Status

📣 Introduction

The 12th project of 42's curriculum is about creating our own IRC server. An actual IRC client will be used to connect to the server and test it. Internet is ruled by solid standards protocols that allow connected computers to interact with each other. It’s always a good thing to know.

📜 Requirements

We have implemented both the mandatory and bonus requirements of this project. The following table summarizes all the possible commands that our IRC server is capable of processing.

Command Usage Flags Description
PASS PASS <password> - Connect to the IRC server by providing a password.
USER USER <username> - Create a new username.
NICK NICK <nickname> - Create a new nickname.
JOIN JOIN <channel> [<key>] - Join a channel, if it already exists, otherwise create a new channel. It's also possible to provide a key (password) to access the channel.
INVITE INVITE <nickname> <channel> - Invite a client to a channel.
TOPIC TOPIC <channel> [<topic>] - Change or view the channel topic.
PRIVMSG PRIVMSG <receiver>{,<receiver>} <text to be sent> - Sends a message to one or more clients or channels. If there are more than one receiver, they must be separated by ,.
MODE MODE <channel> <flag> [<limit>] [<user>] +i or -i Change the channel's mode. This flag sets/removes Invite-only channel.
+t or -t Change the channel's mode. This flag sets/removes the restrictions of the TOPIC command to channel operators.
+k or -k Change the channel's mode. This flag sets/removes the channel key.
+o or -o Change the channel's mode. This flag gives/takes channel operator privilege.
+l or -l Change the channel's mode. This flag sets/removes the user limit to channel.
PART PART <channel> - Leave a channel.
KICK KICK <channel> <user> [<comment>] - Eject a client from the channel. It's also possible to provide a commentary.
QUIT QUIT - Closes the IRC server connection.
MARVINBOT MARVINBOT <flag> marvin Marvin presents himself!
quote Marvin recites a philosophy quote!
time Marvin answers the current time.
whoami Marvin answers who you are.
whois Marvin gets information about other clients logged on the IRC server.

Important

Some command have to meet some requirements for its usage by the client:

  • To execute the command KICK and MODE, the client must have channel operator privileges.
  • To execute the command MARVINBOT, the client must have joined at least one channel.
  • If the command requires a channel, the channel name must begin with #.

⚒️ How to compile and run the project

1) Copy this repository to your local workstation

git clone https://github.com/ygor-sena/42cursus-ft-irc.git

2) Install the required libraries to run the project and the unit tests

sudo apt-get install libcriterion-dev

Note

If your operating system is different than Ubuntu version >= 21.04, then check the official documentation about how to proceed with Criterion framework installation here.

3) Compile the project with Makefile

make

To compile and execute the tests, just run make inside the folder 42-IRC/tests.

4) Launch the IRC server

To launch the IRC server, you must provide a port number and a password. For example, the command below launches the IRC server to listen to port number 4444 and the password to access it is 12345.

./ircserv 4444 12345

5) Connect one or more clients to the IRC server and have fun!

There are two ways to connect a client to the IRC server: via CLI or IRC client of your choice.

Note

We used Hexchat as our IRC client of reference. Therefore, we recommend that you use it as well if you want to connect to the IRC server using a GUI. Check its official documentation about how to install Hexchat IRC client on you local machine here.

To connect to the IRC server on port number 4444 using the command line, open a new terminal and run the following command:

nc localhost 4444

To use the server, you will have to authenticate the client connection by providing a password and registering the client on the server by creating an username and a nickname. For example:

PASS 12345
USER username
NICK nickname

After that, the client is allowed to use all the other IRC command implemented for this project as specified here.

To connect to the IRC server using Hexchat, you have to create a new network called localhost/4444 and select the following options:

  • Connect to selected server only
  • Connect to this network automatically
  • Accept invalid SSL certificates
  • Login method: Server password (/PASS password)
  • Last but not least, fill the fields Nick name, Second choice, Real name, User name and Password

After the setting, you can click on Connect to connect with the IRC server and use the implemented commands on the prompt command line. Since the file management is done by IRC clients, it's possible to send a file from a client to another one if both clients are using Hexchat.

📖 References

Main references:

About network programming:

About recommended design patterns for this project:

About

The 12th project of 42's curriculum is about creating our own IRC server. An actual IRC client will be used to connect to the server and test it. Internet is ruled by solid standards protocols that allow connected computers to interact with each other. It’s always a good thing to know.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •