feat(cmd/topic): Topic addded to dispatch + in constructor

This commit is contained in:
Raphael 2025-06-19 11:34:29 +02:00
parent f3dc9b6ee0
commit 766d54f76e
2 changed files with 22 additions and 14 deletions

View file

@ -6,15 +6,18 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 22:43:24 by rparodi #+# #+# */ /* Created: 2025/05/20 22:43:24 by rparodi #+# #+# */
/* Updated: 2025/06/19 01:16:03 by sben-tay ### ########.fr */ /* Updated: 2025/06/19 11:33:25 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "channel.hpp" #include "channel.hpp"
#include <iostream> #include <iostream>
Channel::Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite) Channel::Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite) : _name(name), _owner(owner), _maxUsers(maxUsers), _needInvite(needInvite) {
:_name(name), _owner(owner), _maxUsers(maxUsers), _needInvite(needInvite) {} this->_protectTopic = false;
this->_maxUsers = ~0;
this->_topic = "No topic is set";
}
/** /**
* @brief Get the name of the channel * @brief Get the name of the channel

View file

@ -6,25 +6,26 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */ /* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 16:11:56 by rparodi #+# #+# */ /* Created: 2025/05/24 16:11:56 by rparodi #+# #+# */
/* Updated: 2025/06/10 16:25:57 by rparodi ### ########.fr */ /* Updated: 2025/06/19 11:25:46 by rparodi ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "commands.hpp" #include "commands.hpp"
#include <cctype> #include <cctype>
#include "join.hpp"
#include "privmsg.hpp"
#include "nick.hpp"
#include "invite.hpp"
#include "list.hpp"
#include "cap.hpp" #include "cap.hpp"
#include "modes.hpp" #include "invite.hpp"
#include "ping.hpp" #include "join.hpp"
#include "notice.hpp"
#include "kick.hpp" #include "kick.hpp"
#include "userCmd.hpp" #include "list.hpp"
#include "pass.hpp" #include "modes.hpp"
#include "nick.hpp"
#include "notice.hpp"
#include "part.hpp" #include "part.hpp"
#include "pass.hpp"
#include "ping.hpp"
#include "privmsg.hpp"
#include "topic.hpp"
#include "userCmd.hpp"
#include "whois.hpp" #include "whois.hpp"
#include "whowas.hpp" #include "whowas.hpp"
#include <iterator> #include <iterator>
@ -139,6 +140,10 @@ void cmd::dispatch(::User *user, Channel *channel, Server *server, std::string &
userCmd(user, channel, server, line).execute(); userCmd(user, channel, server, line).execute();
} }
break; break;
case 't':
if (command_name == "topic") {
Topic(user, channel, server, line).execute();
}
case 'w': case 'w':
if (command_name == "whois") { if (command_name == "whois") {
Whois(user, channel, server, line).execute(); Whois(user, channel, server, line).execute();