{"id":27192246,"url":"https://github.com/saifeddineelhanoune/ft_ircserv","last_synced_at":"2026-07-18T18:04:22.577Z","repository":{"id":286276819,"uuid":"954971292","full_name":"saifeddineelhanoune/ft_ircserv","owner":"saifeddineelhanoune","description":"building irc-protocol in c++-98","archived":false,"fork":false,"pushed_at":"2025-04-05T11:47:21.000Z","size":10690,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"topush","last_synced_at":"2025-09-25T02:56:00.446Z","etag":null,"topics":["accept","bind","channels","chat-application","cpp98","cpp98-compatible","event-driven","irc-protocol","irc-server","listen","oop","poll","posix-compliant"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saifeddineelhanoune.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-03-25T22:47:11.000Z","updated_at":"2025-04-08T09:09:34.000Z","dependencies_parsed_at":"2025-04-09T18:46:16.887Z","dependency_job_id":null,"html_url":"https://github.com/saifeddineelhanoune/ft_ircserv","commit_stats":null,"previous_names":["saifeddineelhanoune/ft_ircserv"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/saifeddineelhanoune/ft_ircserv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saifeddineelhanoune%2Fft_ircserv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saifeddineelhanoune%2Fft_ircserv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saifeddineelhanoune%2Fft_ircserv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saifeddineelhanoune%2Fft_ircserv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saifeddineelhanoune","download_url":"https://codeload.github.com/saifeddineelhanoune/ft_ircserv/tar.gz/refs/heads/topush","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saifeddineelhanoune%2Fft_ircserv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010238,"owners_count":26084718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":["accept","bind","channels","chat-application","cpp98","cpp98-compatible","event-driven","irc-protocol","irc-server","listen","oop","poll","posix-compliant"],"created_at":"2025-04-09T18:44:15.697Z","updated_at":"2025-10-12T04:04:56.128Z","avatar_url":"https://github.com/saifeddineelhanoune.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IRC Server (ft_ircserv)\n\n![IRC Server](https://img.shields.io/badge/IRC-Server-blue)\n![C++98](https://img.shields.io/badge/C%2B%2B-98-orange)\n![Version](https://img.shields.io/badge/Version-1.0-green)\n\n**Last Updated**: 2025-04-05\n\n## Table of Contents\n1. [Introduction](#introduction)\n2. [Project Overview](#project-overview)\n3. [Features](#features)\n4. [Implementation Details](#implementation-details)\n5. [Network Programming Concepts](#network-programming-concepts)\n6. [Project Constraints](#project-constraints)\n7. [Building and Running](#building-and-running)\n8. [Commands](#commands)\n9. [Architecture](#architecture)\n10. [Future Improvements](#future-improvements)\n11. [Credits](#credits)\n\n## Introduction\n\nThis project implements an IRC (Internet Relay Chat) server from scratch in C++. IRC is a text-based communication protocol that facilitates communication in the form of text messages between clients in a client-server networking model.\n\nThe server handles multiple clients simultaneously, manages channels, and implements the core IRC commands according to RFC standards.\n\n## Project Overview\n\nIRC (Internet Relay Chat) is one of the first chat protocols on the internet, dating back to 1988. This implementation follows the core principles of IRC while focusing on a C++98 compliant codebase with robust socket programming and concurrent client handling.\n\nThe server is built to handle:\n- Multiple simultaneous client connections\n- Channel creation and management\n- Private messaging between users\n- Channel operator privileges\n- Various IRC commands as specified in the RFC standards\n\n## Features\n\n- **User Authentication**: Password-protected server access\n- **Nickname Management**: Unique nickname assignment and validation\n- **Channel Operations**: Create, join, leave, and manage channels\n- **Private Messaging**: Direct communication between users\n- **Channel Modes**: Support for various channel modes including:\n  - Invite-only channels\n  - Topic restrictions\n  - Channel password protection\n  - User limits\n  - Operator privileges\n- **Network Communication**: Robust socket programming with polling mechanisms\n- **Command Processing**: Full parsing and execution of IRC commands\n- **Error Handling**: RFC-compliant error responses\n\n## Implementation Details\n\n### Core Components\n\n1. **Server Class**\n   - Manages the main server loop\n   - Handles client connections using poll()\n   - Processes incoming messages and dispatches commands\n\n2. **Client Class**\n   - Represents a connected user\n   - Stores user information (nickname, username, etc.)\n   - Tracks authentication state\n\n3. **Channel Class**\n   - Manages channel properties and members\n   - Handles channel modes and operator privileges\n   - Controls access to channels based on various restrictions\n\n### Socket Programming\n\nThe server uses Berkeley sockets API for network communication:\n- Socket creation and binding\n- Setting up listening sockets\n- Accepting new connections\n- Non-blocking I/O with poll() for handling multiple clients\n\n### Command Handling\n\nCommands are processed using a command dispatcher pattern:\n- Each IRC command maps to a specific handler method\n- Command arguments are parsed and validated\n- Appropriate responses are generated according to RFC specifications\n\n## Network Programming Concepts\n\n### Socket Communication\nThe server utilizes TCP/IP sockets to establish reliable, connection-oriented communication with clients. Key socket-related functions used include:\n- `socket()`: Creates an endpoint for communication\n- `bind()`: Assigns a local address to a socket\n- `listen()`: Marks a socket as passive, ready to accept connections\n- `accept()`: Accepts a connection on a socket\n- `send()/recv()`: Transmits and receives data\n\n### Multiplexing with poll()\nRather than creating a thread for each client (which would violate the project constraints), the server uses `poll()` to multiplex I/O operations:\n- Monitors multiple file descriptors simultaneously\n- Efficiently handles many connections with a single thread\n- Avoids blocking operations that would halt the entire server\n\n## Project Constraints\n\nThis implementation adheres to strict project requirements:\n- **C++ Standard**: Limited to C++98 standard\n- **External Libraries**: No external libraries beyond standard C/C++ libraries and system calls\n- **Threading**: No threads or fork (single process using poll() for concurrency)\n- **Memory Management**: No memory leaks or undefined behaviors\n- **Error Handling**: Robust error handling for all network operations\n- **RFC Compliance**: Implementation follows RFC 1459 and related RFC documents for IRC protocol\n\n## Building and Running\n\n### Prerequisites\n- c++/g++ GCC/Clang compiler with C++98 support\n- Linux/Unix environment (for socket APIs)\n\n### Compilation\n```bash\nmake\n# IRC Server\n\n## Running the Server\n./ircserv \u003cport\u003e \u003cpassword\u003e\n```\n\nWhere:\n* `\u003cport\u003e`: The port number the server will listen on\n* `\u003cpassword\u003e`: Password required for clients to connect to the server\n\n## Connecting with a Client\nYou can connect using any standard IRC client:\n```bash\nnc \u003cserver_ip\u003e \u003cport\u003e\n# Then authenticate with:\nPASS \u003cpassword\u003e\nNICK \u003cyour_nickname\u003e\nUSER \u003cusername\u003e 0 * :\u003crealname\u003e\n```\n\n## Commands\nThe server supports the following IRC commands:\n\n| Command | Format | Description |\n|---------|--------|-------------|\n| PASS | `PASS \u003cpassword\u003e` | Set connection password |\n| NICK | `NICK \u003cnickname\u003e` | Set or change nickname |\n| USER | `USER \u003cusername\u003e \u003cmode\u003e \u003cunused\u003e :\u003crealname\u003e` | Set user information |\n| JOIN | `JOIN \u003cchannel\u003e{,\u003cchannel\u003e} [\u003ckey\u003e{,\u003ckey\u003e}]` | Join channel(s) with optional key(s) |\n| PART | `PART \u003cchannel\u003e{,\u003cchannel\u003e} [\u003cmessage\u003e]` | Leave channel(s) |\n| PRIVMSG | `PRIVMSG \u003ctarget\u003e :\u003cmessage\u003e` | Send message to user or channel |\n| QUIT | `QUIT [\u003cmessage\u003e]` | Disconnect from server |\n| KICK | `KICK \u003cchannel\u003e \u003cuser\u003e [\u003ccomment\u003e]` | Remove user from channel |\n| INVITE | `INVITE \u003cnickname\u003e \u003cchannel\u003e` | Invite user to channel |\n| TOPIC | `TOPIC \u003cchannel\u003e [:\u003ctopic\u003e]` | Set or view channel topic |\n| MODE | `MODE \u003ctarget\u003e \u003cmodes\u003e [\u003cmode-params\u003e]` | Change channel or user mode |\n| PING | `PING \u003cserver\u003e` | Test connection to server |\n| PONG | `PONG \u003cserver\u003e` | Reply to PING message |\n\n## Channel Modes\n| Mode | Parameter | Description |\n|------|-----------|-------------|\n| i | None | Set/remove Invite-only channel |\n| t | None | Set/remove restrictions of TOPIC command |\n| k | Key | Set/remove channel key (password) |\n| o | Nickname | Give/take channel operator privileges |\n| l | Limit | Set/remove user limit to channel |\n\n## Architecture\n### Class Relationships\n```\n┌────────────┐       ┌────────────┐\n│   Server   │◄─────►│   Client   │\n└────────────┘       └────────────┘\n      ▲                    ▲\n      │                    │\n      │                    │\n      ▼                    │\n┌────────────┐             │\n│  Channel   │◄────────────┘\n└────────────┘\n```\n\n* **Server**: Central class managing connections and dispatching commands\n* **Client**: Represents a connected user with their state\n* **Channel**: Handles channel operations and membership\n\n### Data Flow\n1. Client connects to server\n2. Server authenticates client (PASS, NICK, USER)\n3. Client joins channels or sends messages\n4. Server routes messages to appropriate clients\n5. Server handles administrative commands and channel operations\n\n## Future Improvements\n* File transfer capabilities\n* SSL/TLS support for secure connections\n* More extensive channel modes\n* Bot support for automated operations\n* Web interface for server administration\n\n## Credits\nDeveloped by @saifeddineelhanoune @Da-ghost42\n\nProject completed as part of advanced networking programming studies.\n\n© 2025 - IRC Server Implementation - Version 1.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaifeddineelhanoune%2Fft_ircserv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaifeddineelhanoune%2Fft_ircserv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaifeddineelhanoune%2Fft_ircserv/lists"}