This commit is contained in:
2024-01-25 22:48:13 +01:00
parent 8be01173e1
commit 897a41f2b5
2 changed files with 9 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */ /* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */
/* Updated: 2024/01/25 21:46:29 by vvaas ### ########.fr */ /* Updated: 2024/01/25 22:45:17 by vvaas ### ########.fr */
/* */ /* */
/******************************************************************************/ /******************************************************************************/
@@ -34,6 +34,7 @@ namespace irc
_operators.insert(client); _operators.insert(client);
for(client_it it = _clients.begin(); it != _clients.end(); ++it) for(client_it it = _clients.begin(); it != _clients.end(); ++it)
const_cast<unstd::SharedPtr<irc::Client>&>(*it)->sendMsg(client->getNickName(), "JOIN", _name); const_cast<unstd::SharedPtr<irc::Client>&>(*it)->sendMsg(client->getNickName(), "JOIN", _name);
sendWho(client);
} }
void Channel::ModOperator(unstd::SharedPtr<class Client> client, const std::string &clientname, bool mode) void Channel::ModOperator(unstd::SharedPtr<class Client> client, const std::string &clientname, bool mode)
@@ -72,15 +73,18 @@ namespace irc
void Channel::sendWho(unstd::SharedPtr<Client> client) void Channel::sendWho(unstd::SharedPtr<Client> client)
{ {
std::string clientlist(":yipirc " RPL_NAMREPLY " " + client->getNickName() + " = " + getName() + ": "); std::string clientlist(":yipirc " RPL_NAMREPLY " " + client->getNickName() + " @ " + getName() + " :");
for (client_it it = _clients.begin(); it != _clients.end(); ++it) for (client_it it = _clients.begin(); it != _clients.end(); ++it)
{ {
if (isOp(const_cast<unstd::SharedPtr<irc::Client>&>(*it)))
clientlist += '@';
clientlist += const_cast<unstd::SharedPtr<irc::Client>&>(*it)->getNickName() + ' '; clientlist += const_cast<unstd::SharedPtr<irc::Client>&>(*it)->getNickName() + ' ';
} }
logs::report(log_message, "%s", clientlist.c_str()); logs::report(log_message, "%s", clientlist.c_str());
client->sendModular("%s\r\n", clientlist.c_str()); client->sendModular("%s\r\n", clientlist.c_str());
client->sendModular("%s %s %s : End of names list\r\n", RPL_ENDOFNAMES, client->getNickName().c_str(), getName().c_str()); clientlist = ":yipirc " RPL_NAMREPLY " " + client->getNickName() + " @ " + getName() + " :";
client->sendModular(":yipirc %s %s %s : End of names list\r\n", RPL_ENDOFNAMES, client->getNickName().c_str(), getName().c_str());
} }
void Channel::handleMessage(const std::string& msg, unstd::SharedPtr<Client> client, bool notice) const void Channel::handleMessage(const std::string& msg, unstd::SharedPtr<Client> client, bool notice) const

View File

@@ -6,7 +6,7 @@
/* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: vvaas <vvaas@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/22 17:31:06 by maldavid #+# #+# */ /* Created: 2024/01/22 17:31:06 by maldavid #+# #+# */
/* Updated: 2024/01/25 21:21:04 by maldavid ### ########.fr */ /* Updated: 2024/01/25 22:04:39 by vvaas ### ########.fr */
/* */ /* */
/******************************************************************************/ /******************************************************************************/
@@ -78,7 +78,7 @@ namespace irc
if(msg.getTokens()[1] == _password) if(msg.getTokens()[1] == _password)
{ {
client->login(); client->login();
client->sendCode(RPL_WELCOME, "Welcome to yipiirc :)\n"); client->sendCode("Welcome to", "yipiirc :)\n");
} }
else else
{ {