Skip to content

lumrt/ft_irc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project has been created as part of the 42 curriculum.

ft_irc — IRC Server

A single-process, non-blocking IRC server in C++98 using poll() for I/O multiplexing. Handles multiple simultaneous clients over TCP/IPv4.

Build

make        # compile
make re     # full recompile
make clean  # remove .o files
make fclean # remove .o + binary

Flags: -Wall -Wextra -Werror -std=c++98

Run

./ircserv <port> <password>

Test with irssi (reference client)

irssi -c 127.0.0.1 -p 6667 -w mypass -n mynick

Test with nc

nc -C 127.0.0.1 6667
PASS mypass
NICK test
USER test 0 * :Test User
JOIN #channel
PRIVMSG #channel :Hello
QUIT

Project Structure

inc/
    Server.hpp     Server class (network, dispatch, signal handling)
    Client.hpp     Client state (fd, nick, user, buffer, registration)
    Channel.hpp    Channel (members, operators, modes i/t/k/l, invites, topic)
    Message.hpp    IRC message parser + splitList utility

src/
    main.cpp       Entry point, argument validation, try/catch
    Server.cpp     Socket, poll loop, buffering, dispatch, send, signals
    Client.cpp     Getters/setters, prefix generation
    Channel.cpp    Members, operators, modes, invite list
    Message.cpp    IRC parser (prefix, command, params, trailing)
    commands/
        Pass.cpp       PASS  — connection password
        Nick.cpp       NICK  — set/change nickname (broadcast to channels)
        User.cpp       USER  — set username + realname
        Quit.cpp       QUIT  — clean disconnection
        Join.cpp       JOIN  — join channels (with +i/+k/+l checks)
        Part.cpp       PART  — leave channels
        Privmsg.cpp    PRIVMSG — channel + private messages
        Notice.cpp     NOTICE  — like PRIVMSG, no error replies
        Kick.cpp       KICK  — eject user (operator only)
        Invite.cpp     INVITE — invite to +i channel (operator only)
        Topic.cpp      TOPIC — view/change topic (+t = operator only)
        Mode.cpp       MODE  — channel modes: i, t, k, o, l
        Ping.cpp       PING  — keepalive (responds PONG)
        Who.cpp        WHO   — channel member list

Implemented Features

  • Authentication (PASS), nickname (NICK), username (USER)
  • Join/leave channels (JOIN, PART)
  • Private and channel messages (PRIVMSG, NOTICE)
  • Operator commands: KICK, INVITE, TOPIC
  • Channel modes: invite-only (+i), topic lock (+t), key (+k), operator (+o), user limit (+l)
  • Clean disconnection (QUIT) with broadcast to channels
  • PING/PONG keepalive
  • Signal handling (SIGINT, SIGTERM, SIGPIPE)
  • Partial data reconstruction (buffering on \r\n)
  • Non-blocking I/O, single poll() for all operations

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors