commit
4b900fc600
4 changed files with 41 additions and 22 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/23 15:27:38 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/24 14:35:17 by sben-tay ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -78,9 +78,10 @@ void Kick::execute() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// std::string msgPart = ":" + _sender->getPrefix() + " PART #" + _cTarget->getName();
|
||||||
|
|
||||||
std::string msgPart = ":" + this->_uTarget->getPrefix() + " PART #" + _cTarget->getName() + "\r\n";
|
std::string msgPart = ":" + this->_uTarget->getPrefix() + " PART #" + _cTarget->getName() + "\r\n";
|
||||||
std::string msgKick = ":" + this->_uTarget->getPrefix() + " KICK #" + this->_cTarget->getName() + " " + _uTarget->getName();
|
std::string msgKick = ":" + _sender->getPrefix() + " KICK #" + this->_cTarget->getName() + " " + _uTarget->getName();
|
||||||
if (_args.size() > 3)
|
if (_args.size() > 3)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Je rajoute le message de kick avec un motif");
|
DEBUG_MSG("Je rajoute le message de kick avec un motif");
|
||||||
|
|
@ -89,8 +90,8 @@ void Kick::execute() {
|
||||||
msgKick += "\r\n";
|
msgKick += "\r\n";
|
||||||
|
|
||||||
std::cout << " msgKick: " << msgKick << "msgPart: " << msgPart << std::endl;
|
std::cout << " msgKick: " << msgKick << "msgPart: " << msgPart << std::endl;
|
||||||
_cTarget->sendAllClientInAChannel(msgKick);
|
|
||||||
_uTarget->appendToWriteBuffer(msgPart);
|
_uTarget->appendToWriteBuffer(msgPart);
|
||||||
|
_cTarget->sendAllClientInAChannel(msgKick);
|
||||||
|
|
||||||
_cTarget->removeUser(this->_uTarget);
|
_cTarget->removeUser(this->_uTarget);
|
||||||
_cTarget->removeOperator(this->_uTarget);
|
_cTarget->removeOperator(this->_uTarget);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/19 01:13:28 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/24 14:31:15 by sben-tay ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -69,7 +69,6 @@ void Part::execute() {
|
||||||
_cTarget->sendAllClientInAChannel(msgPart);
|
_cTarget->sendAllClientInAChannel(msgPart);
|
||||||
_cTarget->removeUser(_sender);
|
_cTarget->removeUser(_sender);
|
||||||
_cTarget->removeOperator(_sender);
|
_cTarget->removeOperator(_sender);
|
||||||
// remove invited list
|
|
||||||
|
|
||||||
if (_cTarget->getUsers().empty()) {
|
if (_cTarget->getUsers().empty()) {
|
||||||
std::list<Channel*>& allChannels = _server->getChannelsList();
|
std::list<Channel*>& allChannels = _server->getChannelsList();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/22 01:53:33 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/24 14:02:33 by sben-tay ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
#include "commands.hpp"
|
#include "commands.hpp"
|
||||||
#include "logs.hpp"
|
#include "logs.hpp"
|
||||||
#include "bonus.hpp"
|
#include "bonus.hpp"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace cmd;
|
using namespace cmd;
|
||||||
|
|
||||||
|
|
@ -64,34 +65,51 @@ void PrivMsg::execute() {
|
||||||
|
|
||||||
//bonus msgBot
|
//bonus msgBot
|
||||||
std::string msgBot = ":bot!ircbot@localhost PRIVMSG " + target + " :📜 Liste des commandes disponibles :\r\n";
|
std::string msgBot = ":bot!ircbot@localhost PRIVMSG " + target + " :📜 Liste des commandes disponibles :\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- JOIN #channel → Rejoindre un canal\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- JOIN #channel → Rejoindre un canal\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- PART #channel → Quitter un canal\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- PART #channel → Quitter un canal\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- PRIVMSG <cible> msg → Envoyer un message\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- PRIVMSG <cible> msg → Envoyer un message\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- TOPIC #channel :txt → Voir / modifier le topic\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- TOPIC #channel :txt → Voir / modifier le topic\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- MODE #channel +o nick → Ajouter un opérateur\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- MODE #channel +o nick → Ajouter un opérateur\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- INVITE nick #channel → Inviter un utilisateur\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- INVITE nick #channel → Inviter un utilisateur\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- KICK #channel nick → Éjecter un utilisateur\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- KICK #channel nick → Éjecter un utilisateur\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- WHO / WHOIS → Infos sur les utilisateurs\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- WHO / WHOIS → Infos sur les utilisateurs\r\n";
|
||||||
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- DCC SEND nick /PATH → Transferer des fichiers à l'utilisateur\r\n";
|
||||||
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- DCC GET /PATH → Accepter le transfert des fichiers reçu\r\n";
|
||||||
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- !emote → Affiche la liste d'emoji\r\n";
|
||||||
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- !help → Affiche cette aide\r\n";
|
msgBot += ":bot!ircbot@localhost PRIVMSG " + target + " :- !help → Affiche cette aide\r\n";
|
||||||
|
|
||||||
|
std::string msgEmote = ":bot!ircbot@localhost PRIVMSG " + target + " : 📜 Emote list :\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :😐😑😒😓😔😕😖😗😘😙😚😛😜😝😞😟\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :😠😡😢😣😤😥😦😧😨😩😪😫😬😭😮😯\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :😰😱😲😳😴😵😶😷😸😹😺😻😼😽😾😿\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :🙀🙁🙂🙃🙄🙅🙆🙇🙈🙉🙊🙋🙌🙍🙎🙏\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :🤐🤑🤒🤓🤤🤔🤕🤖🤗🤘🤙🤚🤛🤜🤝🤟\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :💐💑💒💓💔💕💖💗💘💙💚💛💜💝💞💟\r\n";
|
||||||
|
msgEmote += ":bot!ircbot@localhost PRIVMSG " + target + " :💠💡💢💣💤💥💦💧💨💩💪💫💬💭💯🤨\r\n";
|
||||||
|
|
||||||
|
std::cout << "target = " << target << std::endl;
|
||||||
// Envoi vers un channel
|
// Envoi vers un channel
|
||||||
if (target[0] == '#') {
|
if (target[0] == '#') {
|
||||||
target.erase(0, 1);
|
target.erase(0, 1);
|
||||||
if (_cTarget)
|
|
||||||
_cTarget->sendAllClientInAChannel(msg, _sender);
|
if (_cTarget) {
|
||||||
|
if (BONUS && _cTarget->getBotChannel() && _args.at(2) == "!help")
|
||||||
if (BONUS && _cTarget->getBotChannel()) {
|
_sender->appendToWriteBuffer(msgBot);
|
||||||
if (_args.at(2) == "!help") {
|
else if (BONUS && _cTarget->getBotChannel() && _args.at(2) == "!emote")
|
||||||
std::cout << "BONUS: PING command received, sending PONG" << std::endl;
|
_sender->appendToWriteBuffer(msgEmote);
|
||||||
_cTarget->sendAllClientInAChannel(msgBot);
|
else
|
||||||
}
|
_cTarget->sendAllClientInAChannel(msg, _sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Envoi vers un user
|
// Envoi vers un user
|
||||||
else {
|
const std::list<User *>& users = _server->getUsersList();
|
||||||
if (_uTarget)
|
|
||||||
_uTarget->appendToWriteBuffer(msg);
|
for (std::list<User *>::const_iterator it = users.begin(); it != users.end(); ++it) {
|
||||||
|
if ((*it)->getName() == target) {
|
||||||
|
(*it)->appendToWriteBuffer(msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/13 11:03:13 by rparodi #+# #+# */
|
/* Created: 2025/05/13 11:03:13 by rparodi #+# #+# */
|
||||||
/* Updated: 2025/06/23 14:38:53 by sben-tay ### ########.fr */
|
/* Updated: 2025/06/24 00:47:18 by sben-tay ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -28,3 +28,4 @@ int main(int argc, char *argv[]) {
|
||||||
server.start();
|
server.start();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue