This commit is contained in:
Kbz-8
2024-01-22 20:24:56 +01:00
parent 687390be3b
commit 07438699eb
3 changed files with 25 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 10:34:25 by maldavid #+# #+# */ /* Created: 2024/01/21 10:34:25 by maldavid #+# #+# */
/* Updated: 2024/01/22 18:14:50 by maldavid ### ########.fr */ /* Updated: 2024/01/22 20:05:52 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -37,6 +37,8 @@ namespace irc
inline bool isInviteOnly() const { return _invite_only; } inline bool isInviteOnly() const { return _invite_only; }
void setTopic(unstd::SharedPtr<Client> client, const std::string& new_topic);
~Channel(); ~Channel();
private: private:
@@ -44,7 +46,9 @@ namespace irc
std::set<unstd::SharedPtr<Client> > _operators; std::set<unstd::SharedPtr<Client> > _operators;
const std::string _name; const std::string _name;
std::string _password; std::string _password;
std::string _topic;
bool _invite_only; bool _invite_only;
bool _topic_op_restrict;
}; };
} }

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */ /* Created: 2024/01/21 10:36:21 by maldavid #+# #+# */
/* Updated: 2024/01/22 14:29:55 by maldavid ### ########.fr */ /* Updated: 2024/01/22 20:06:36 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -19,5 +19,14 @@ namespace irc
} }
void Channel::setTopic(unstd::SharedPtr<Client> client, const std::string& new_topic)
{
if(_topic_op_restrict && _operators.find(client) == _operators.end())
{
// send error code to user
}
_topic = new_topic;
}
Channel::~Channel() {} Channel::~Channel() {}
} }

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/22 17:31:06 by maldavid #+# #+# */ /* Created: 2024/01/22 17:31:06 by maldavid #+# #+# */
/* Updated: 2024/01/22 19:56:18 by maldavid ### ########.fr */ /* Updated: 2024/01/22 20:19:50 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -170,8 +170,15 @@ namespace irc
void Server::handleTopic(unstd::SharedPtr<class Client> client, const Message& msg) void Server::handleTopic(unstd::SharedPtr<class Client> client, const Message& msg)
{ {
(void)client; if(msg.getTokens().size() == 1)
(void)msg; {
logs::report(log_error, "TOPIC, invalid command '%s'", msg.getRawMsg().c_str());
return;
}
for(std::vector<unstd::SharedPtr<Client> >::iterator it = _client.begin(); it != _client.end(); ++it)
{
}
} }
void Server::handlePing(unstd::SharedPtr<class Client> client, const Message& msg) void Server::handlePing(unstd::SharedPtr<class Client> client, const Message& msg)