diff --git a/diagram.puml b/diagram.puml index 03742fb..05ae631 100644 --- a/diagram.puml +++ b/diagram.puml @@ -86,7 +86,7 @@ class Channel { ' ==================================== package "CommandDispatcher" <> { class CommandDispatcher { - + dispatchCommand(user : User, line : string) : void + + dispatchCommand(user : *User, channel : *channel, line : string) : void + splitCommand(line : string) : vector } } diff --git a/include/commands.hpp b/include/commands.hpp index ebc4d31..486fa83 100644 --- a/include/commands.hpp +++ b/include/commands.hpp @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/05/20 23:31:58 by rparodi #+# #+# */ -/* Updated: 2025/05/20 23:41:28 by rparodi ### ########.fr */ +/* Updated: 2025/05/20 23:49:46 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,21 +15,29 @@ #include #include #include "user.hpp" +#include "channel.hpp" namespace cmd { - void dispatch(User user, const std::string &line); + /** + * @brief To send the line where a command is invoqued to execute + * + * @param user user who send the command + * @param channel channel where the command is sent + * @param line line send by the user + */ + void dispatch(User *user, Channel *channel, const std::string &line); std::vector split(const std::string &line); - class ACommand { + class ICommand { private: std::string _command; std::vector _args; User _user; public: - virtual bool execute() = 0; - ~ACommand(); - ACommand(User user, const std::string &line); + virtual void execute() = 0; + ~ICommand(); + ICommand(User *user, Channel *channel, const std::string &line); }; class Invite;