{"id":51202177,"url":"https://github.com/djimenezweb/ft_irc","last_synced_at":"2026-06-28T01:03:15.747Z","repository":{"id":366094511,"uuid":"1275035814","full_name":"djimenezweb/ft_irc","owner":"djimenezweb","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-20T07:31:06.000Z","size":167,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-20T09:10:38.649Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djimenezweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-20T07:01:30.000Z","updated_at":"2026-06-20T07:31:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/djimenezweb/ft_irc","commit_stats":null,"previous_names":["djimenezweb/ft_irc"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/djimenezweb/ft_irc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djimenezweb%2Fft_irc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djimenezweb%2Fft_irc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djimenezweb%2Fft_irc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djimenezweb%2Fft_irc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djimenezweb","download_url":"https://codeload.github.com/djimenezweb/ft_irc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djimenezweb%2Fft_irc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34873664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-28T01:03:12.967Z","updated_at":"2026-06-28T01:03:15.743Z","avatar_url":"https://github.com/djimenezweb.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"*This project has been created as part of the 42 curriculum by aldiaz-u, danielji, and mparra-s*\n\n# ft_irc\n\n![IRC server screenshot](screenshot.png)\n\n## Description\n\n\u003c!-- Clearly presents the project, including its goal and a brief overview. --\u003e\n\nThis project is an IRC server written in C++98 using **Linux sockets** and **non-blocking I/O**. Any client should be able to connect and communicate with it following standard IRC protocols.\n\n### The Linux socket API\n\n\u003e Adapted from [The Linux socket API explained](https://www.youtube.com/watch?v=XXfdzwEsxFk) by Chris Kanich.\n\nBoth server and clients perform similar system calls before any connection attempt. When the server is listening, a client first requests a connection with `connect()`  and the server accepts it by calling `accept()`. Once server and client are connected through a socket, they can both send and receive data from each other using `recv` and `send`.\n\nWhen a client disconnects it sends an `EOF` message, the server reads a message of 0 bytes length and then closes the connection.\n\n```\n   SERVER            CLIENT\n   ======            ======\n\n getaddrinfo       getaddrinfo\n     ↓                 ↓\n   socket            socket\n     ↓                 |\n    bind               |\n     ↓                 |\n   listen              |\n     ↓                 ↓\n   accept \u003c-------- connect\n     ↓                 ↓\n    recv \u003c---------- send\n     ↓                 ↓\n    send ----------\u003e recv\n     ↓                 ↓\n    recv \u003c-- EOF --- close\n     ↓\n   close\n```\n\n### Non-Blocking I/O\n\nThe `recv`, `send` and `accept` system calls are blocking. That means the server would block while `recv` waits for more data to come.\n\nThis IRC server relies on `poll` to achieve non-blocking I/O operations. `poll` watches file descriptors and tells us when any file descriptor is ready to perform I/O operations. We then only call `recv` when `poll` guarantees the data is already available, so `recv` returns immediately instead of blocking the server.\n\n## Instructions\n\n\u003c!-- Contains any relevant information about compilation, installation, and/or execution. --\u003e\n\n```sh\n# Compile:\n$ make\n\n# Compile bot:\n$ make bonus\n\n# Run:\n$ ./ircserv \u003cport\u003e \u003cpassword\u003e\n\n# Run bot:\n$ ./ircserv_bonus\n\n# For example:\n$ ./ircserv 6667 1234\n\n# Press Ctrl+C to stop and exit the program:\n$ ^C\n```\n\n### How to connect using `nc`\n\nYou can use [Ncat](https://nmap.org/ncat/) or [Netcat](https://sectools.org/tool/netcat/) to connect to the IRC server. Run `nc` with `-C` option to use CRLF for end of line sequence. Specify the same host and port used in the server. For example:\n\n```sh\nnc -C localhost 6667\n```\n\nTo complete the registration process send the following commands in this order. Replace `\u003cpass\u003e` by the server's password and `\u003cnick\u003e` by any valid nickname of your choice.\n\n```\nCAP LS 302\nPASS \u003cpass\u003e\nNICK \u003cnick\u003e\nUSER \u003cnick\u003e 0 * :realname\nCAP END\n```\n\nUpon registration you may now join to channels, send private messages, etc.\n\n```\nJOIN #42madrid\nPRIVMSG #42madrid :Hello you all!\n```\n\nType `Ctrl`+`C` to quit.\n\n### How to connect using HexChat\n\n[HexChat](https://hexchat.github.io/) is an open source IRC client. It provides a friendly interface to interact with.\n\nWhen using HexChat you must prefix every command with `/`, (i.e. `/join #42madrid`).\n\n- Open HexChat, fill in **Nick name** and **User name**.\n- Press **Add** to add a new network and then press **Edit...**.\n- Change `newserver/6697` to the server's IP and port. (For example, `localhost/6667` or `127.0.0.1/6667`).\n- Uncheck `Use SSL for all the servers on this network`.\n- Set **Login method** to `Default` or `Server password (/PASS password)`.\n- Press **Close** to apply the changes and finally click on **Connect**.\n\n## Commands\n\nClients can send the following commands to the IRC server:\n\n| Command | Description | Example | Reference |\n| ------- | ----------- | ------- | --------- |\n| `CAP` | Used during user registration for capability negotiation between a server and a client. | `CAP * LS 302` | [CAP](https://modern.ircdocs.horse/#cap-message) |\n| `PASS` | Set a connection password. | `PASS 1234` | [PASS](https://modern.ircdocs.horse/#pass-message) |\n| `NICK` | Give the client a nickname or change the previous one. | `NICK homer89` | [NICK](https://modern.ircdocs.horse/#nick-message) |\n| `USER` | Used at the beginning of a connection to specify the username and realname of a new user. | `USER homer 0 * :Homer Simpson` | [USER](https://modern.ircdocs.horse/#user-message) |\n| `PING` | Sent by either clients or servers to check if the other side of the connection is still connected. | `PING LAG1781564777701` | [PING](https://modern.ircdocs.horse/#ping-message) |\n| `QUIT` | Terminate a client’s connection to the server. | `QUIT :Gone to evaluate someone's Libft` | [QUIT](https://modern.ircdocs.horse/#quit-message) |\n| `JOIN` | Join or create a channel. \u003csup\u003e[*(notes)*](#join)\u003c/sup\u003e | `JOIN #born2code` | [JOIN](https://modern.ircdocs.horse/#join-message) |\n| `PART` | Exit from the given channels. | `PART #born2code,#42madrid :Absorbed by the blackhole` | [PART](https://modern.ircdocs.horse/#part-message) |\n| `TOPIC` | Change or view the topic of the given channel. \u003csup\u003e[*(notes)*](#topic)\u003c/sup\u003e | `TOPIC #catmemes :Share your favorite cat memes` | [TOPIC](https://modern.ircdocs.horse/#topic-message) |\n| `NAMES` | List the nicknames joined to a channel. Channel operators are prefixed with `@`. | `NAMES #42madrid` | [NAMES](https://modern.ircdocs.horse/#names-message) |\n| `LIST` | Get a list of channels along with some information about each channel. | `LIST` | [LIST](https://modern.ircdocs.horse/#list-message) |\n| `INVITE` | Invite a user to a channel. | `INVITE aldiaz-u #born2code` | [INVITE](https://modern.ircdocs.horse/#invite-message) |\n| `KICK` | Remove a user from a channel. | `KICK #born2code danielji :Very noisy user` | [KICK](https://modern.ircdocs.horse/#kick-message) |\n| `PRIVMSG` | Send private messages between users or to members of channels. | `PRIVMSG rachel-g :How you doin?` | [PRIVMSG](https://modern.ircdocs.horse/#privmsg-message) |\n| `NOTICE` | Send notices between users or to members of channels. | `NOTICE #born2code :Can someone evaluate an Inception?` | [NOTICE](https://modern.ircdocs.horse/#notice-message) |\n| `WHO` | Query a list of users from a channel. | `WHO #42madrid` | [WHO](https://modern.ircdocs.horse/#who-message) |\n| `MODE` | Set or unset options from a channel. \u003csup\u003e[*(notes)*](#mode)\u003c/sup\u003e | `MODE #mychan +k 12345` | [MODE](https://modern.ircdocs.horse/#mode-message) |\n\n### JOIN\n\nUse `JOIN` to join an existing channel or create a new one. If the specified channel doesn't exist it will be created and you will become a channel operator.\n\nYou may specify a list of comma-separated channels.\n\nProvide a password argument if the channel requires it or if you want to create a password-protected channel.\n\n```\nJOIN #born2code\n\nJOIN #born2code 1234\n\nJOIN #born2code,#42madrid 1234\n```\n\n### TOPIC\n\nIf the protected topic mode is set on a channel, clients must have appropriate channel permissions to modify the topic of that channel.\n\n```\nTOPIC #catmemes\n\nTOPIC #catmemes :Share your favorite cat memes\n```\n\n### MODE\n\nSet (`+`) or unset (`-`) options from a channel. You may combine multiple options and their arguments in one single command. The server should reply with a list of the applied changes, if any.\n\n- `+i`: Set channel to invite-only mode\n- `+t`: Only channel operators can modify topic\n- `+k`: Set a password to join channel\n- `+l`: Set a user limit to a channel\n- `+o`: Give operator privileges to a user\n\n```\nMODE #mychan\n\nMODE #mychan +k 1234\n\nMODE #mychan +l 100\n\nMODE #mychan +o joey33\n\nMODE #mychan +ikl-t 1234 100\n```\n\n### BOT\n\nRun the bot in a different terminal from the server. The bot will join every\npublic channel available and also create its own `#Omni-bot` channel.\n\nThe bot acts as an AI assistant that connects to a public API to answer any\nquestion users ask. Use the `!ask` command followed by your question and the\nbot will reply in the same channel, with a response of up to 400 characters.\n\n\n## Resources\n\u003c!-- Classic references related to the topic (documentation, articles, tutorials, etc.),\nas well as a description of how AI was used —specifying for which tasks and which parts of the project. --\u003e\n\n- Jack Allnutt, Daniel Oaks, Val Lorentz: [Modern IRC Client Protocol](https://modern.ircdocs.horse/)\n- [IRC Protocol Documentation](https://dd.ircdocs.horse/)\n- The UChicago χ-Projects: [chirc](http://chi.cs.uchicago.edu/chirc/index.html)\n- Chris Kanich: [The Linux socket API explained](https://www.youtube.com/watch?v=XXfdzwEsxFk)\n- Brian “Beej Jorgensen” Hall: [Beej's Guide to Network Programming](https://beej.us/guide/bgnet/)\n\n### How AI was used\n\nAI tools were helpful to clarify basic concepts about socket connections and non-blocking operations, as well as to solve bugs we were having trouble with.\n\nAdditionaly we asked AI tools how to force system errors to test the server's error handling.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjimenezweb%2Fft_irc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjimenezweb%2Fft_irc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjimenezweb%2Fft_irc/lists"}