How aberkach/ft_irc works
Project type and purpose
• This is a C++98–based network server project (“Mandatory”) implementing a standards-compliant IRC server, plus an optional IRC bot client (“Bonus”).
• Purpose: handle multiple concurrent IRC clients over TCP/IP (IPv4/IPv6), authenticate them, manage channels/users, parse IRC commands, broadcast messages, and optionally run an automated bot for channel assistance.
File structure
Top-level:
• .gitignore, Makefile, README.md
• Mandatory/ – IRC server code
– Inc/define.hpp, irc.hpp (central definitions and protocol constants)
– src/
· server/ (server socket setup, poll-based event loop, connection acceptance)
· client/ (per-client session state, read/write buffers)
· channel/ (channel data structures, member lists, topics)
· commands/ (implementations of IRC commands: JOIN, PRIVMSG, MODE, etc.)
· tools/ (parsing utilities, helper functions)
• Bonus/ – standalone IRC bot client (defines, main, bot logic and commands)
• tests/ – Python test script to simulate client commands
Review insights from the README
• Architecture: single-threaded, event-driven using poll()
• Core subsystems: connection management, protocol parser, command dispatcher, channel/user managers
• Compliance with RFC 1459/2812, plus additional bot features
Main components
a. External Clients & Bot
• “IRC Client(s)” (e.g., HexChat)
• “IRC Bot” (Bonus executable)
b. Network Layer
• TCP/IP Listener (IPv4/IPv6 socket)
• Event Loop (poll-based I/O multiplexer)
c. Core Server Modules
• Connection Manager: accepts new sockets, tracks client sessions
• Protocol Parser: tokenizes incoming messages into verbs/params
• Command Dispatcher: routes parsed commands to specific handlers
• Authentication Module: PASS, NICK, USER validation
• Channel Manager: create/join/leave channels, store channel metadata
• User Manager: track nicknames, modes, privileges
• Message Broadcaster: fan-out messages to channel members or specific user
d. Utility Subsystems
• Parsing Tools (parsers for message format, numeric replies)
• Server Utils (error handling, logging)
e. Data Stores (in-memory)
• Client State Objects
• Channel State Objects
Relationships and interactions
• “Listener” → “Event Loop” → “Connection Manager” → “Protocol Parser”
• “Parser” → “Command Dispatcher” → (Authentication / Channel Manager / User Manager / Message Broadcaster)
• Responses flow back: e.g., “Message Broadcaster” → “Connection Manager” → “Event Loop” → “Client”
• Bonus: “IRC Bot” behaves like another external client interacting through the same path
Architectural patterns and design principles
• Event-driven Reactor pattern (poll() drives dispatching)
• Modular separation: each command group in its own “commands/” module
• Single responsibility: Connection vs. Parsing vs. Business logic
• In-memory data model; no persistence layer
Technologies, frameworks, libraries
• C++98, POSIX sockets, poll() syscall
• Makefile build system
• Python for test harness (tests/testing_script.py)