need fix kick from bot

This commit is contained in:
Samy Ben Tayeb 2025-06-21 19:25:31 +02:00
parent 6716df3af4
commit 3af74931c7
11 changed files with 115 additions and 24 deletions

18
include/bonus.hpp Normal file
View file

@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bonus.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/21 12:09:57 by sben-tay #+# #+# */
/* Updated: 2025/06/21 18:55:38 by sben-tay ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef BONUS_HPP
# define BONUS_HPP
// # define BONUS 0
#endif

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 22:18:17 by rparodi #+# #+# */
/* Updated: 2025/06/19 13:42:03 by sben-tay ### ########.fr */
/* Updated: 2025/06/21 14:36:38 by sben-tay ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@
class Channel {
public:
Channel(const std::string &name, User *owner, size_t maxUsers, bool needInvite);
~Channel();
// getters
std::string getName() const;
std::string getTopic() const;
@ -47,6 +47,8 @@ class Channel {
bool isInvited(User *user) const;
void removeUser(User *user);
void removeOperator(User *user);
void setBotChannel(bool isBot);
bool getBotChannel() const;
// utility functions
void sendAllClientInAChannel(const std::string &toSend, User *exclude = NULL);
@ -62,6 +64,7 @@ class Channel {
std::list<User *> _operators;
std::list<User *> _users;
std::list<User *> _invited;
bool _botChannel;
};

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 23:31:58 by rparodi #+# #+# */
/* Updated: 2025/06/19 13:00:30 by rparodi ### ########.fr */
/* Updated: 2025/06/21 17:53:03 by sben-tay ### ########.fr */
/* */
/* ************************************************************************** */
@ -65,6 +65,6 @@ namespace cmd
class userCmd;
class Whois;
class Whowas;
};
};
#include "./commands/commands.tpp"

View file

@ -6,7 +6,7 @@
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 21:57:49 by rparodi #+# #+# */
/* Updated: 2025/06/20 19:17:53 by sben-tay ### ########.fr */
/* Updated: 2025/06/21 14:38:06 by sben-tay ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,6 +15,7 @@
#include <string>
#include "PollManager.hpp"
class User
{
private:
@ -38,6 +39,7 @@ class User
public:
User(short unsigned fd, PollManager& poll);
User( void ); // default constructor for bot service
short unsigned int getFd() const;
void appendToReadBuffer(const std::string &data);
void appendToWriteBuffer(const std::string &data);
@ -61,10 +63,11 @@ class User
const std::string getRealname(void) const;
const std::string getNickname() const;
const std::string getWriteBuffer() const;
const std::string& getHostname() const;
const std::string& getIpAddress() const;
const std::string getHostname() const;
const std::string getIpAddress() const;
const std::string getName() const;
const std::string getPrefix() const;
const std::string getReadBuffer() const;
bool hasDataToSend() const;
bool getHasPass() const;