Skip to content
/ ft_irc Public
forked from mxafi/ft_irc

Built an IRC server in C++ following RFC 1459 standards. Implemented core functionalities like message handling, private messaging, and user management. Focused on code structure, reliability, and team collaboration.

License

Notifications You must be signed in to change notification settings

liocle/ft_irc

 
 

Repository files navigation

ft_irc - Internet Relay Chat Server

Description

ft_irc is an IRC server implemented in modern C++, following RFC1459 and IRCv3 conventions. It supports multi-client connections, user authentication, nick/user management, channel join/leave operations, and private messaging.

Built collaboratively as part of the Hive Helsinki 42 curriculum.

Key Features

  • RFC-compliant command parsing
  • Robust input validation and error handling
  • Multi-client management via non-blocking sockets
  • Clear separation of message parsing, client state, and command execution
  • Unit tested with Catch2

Getting Started

git clone https://github.com/mxafi/ft_irc
cd ft_irc && make
./ircserv <port> <password>
  • port: Port to bind the server
  • password: Required password for clients to connect

Contributors


🔧 Personal Contribution

While many parts of this project were developed collaboratively through pair programming and peer reviews, the following elements were authored and tested independently by me:

  • Implementation of nickname validation and command execution logic
  • Catch2 test suites covering input parsing, PRIVMSG, and protocol-compliance edge cases (excluding server state tests)
  • Pull requests listed below that focus on testing, refactoring, and feature development

These contributions reflect my personal initiative and responsibility within the project.

🔄 My Pull Requests

Date Commit Description
2024-03-20 b5d3014 Test/command/execute (#87)
2024-03-16 30b7d59 Additional tests for NICK command (#75)
2024-03-14 91f0e09 Refactor reply.h, remove magic numbers (#69)
2024-02-21 7ad2aca Implemented Message class and parsing logic (#19)

See full list on GitHub.


🧪 Unit Testing with Catch2

We used Catch2 to implement robust unit and integration tests covering:

  • Nickname validation (RFC2812 rules + DALnet extensions)
  • PRIVMSG routing
  • Command execution logic
  • Error message handling
  • Input edge cases (nulls, whitespace, multi-targets, Unicode, etc.)

Example: Nickname Validation Tests

We tested over 30 cases for nickname parsing:

  • Valid input trimming and truncation
  • Invalid characters: * ? @ . : & $ \n \t
  • Empty or whitespace-only input
  • Unicode and control characters
Test Snippet (Click to expand)
TEST_CASE("Nick", "[command][nick]") {
    REQUIRE(client1.getNickname() == expectedNick);
    REQUIRE(client1.getNickname().length() <= 9);
}

🧩 Architectural Notes

  • Client, Message, and Command classes handle connection state, message parsing, and command dispatch.
  • Command::execute() orchestrates validation, reply construction, and client interaction.
  • Test cases explore unregistered states, malformed messages, multi-client routing, and protocol correctness.

License

MIT

About

Built an IRC server in C++ following RFC 1459 standards. Implemented core functionalities like message handling, private messaging, and user management. Focused on code structure, reliability, and team collaboration.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 99.2%
  • Other 0.8%