diff --git a/include/commands.hpp b/include/commands.hpp index 486fa83..1a90755 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:49:46 by rparodi ### ########.fr */ +/* Updated: 2025/05/24 17:41:11 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,6 +16,8 @@ #include #include "user.hpp" #include "channel.hpp" +#include "server.hpp" +#include "logs.hpp" namespace cmd { @@ -28,16 +30,25 @@ namespace cmd */ void dispatch(User *user, Channel *channel, const std::string &line); std::vector split(const std::string &line); + template + T searchList(const std::list &list, const std::string &name); - class ICommand { - private: + class ACommand { + protected: + User* _sender; + User* _uTarget; + Channel *_channel; + Channel *_cTarget; + Server *_server; + std::list _channels; + std::list _users; std::string _command; std::vector _args; - User _user; public: virtual void execute() = 0; - ~ICommand(); - ICommand(User *user, Channel *channel, const std::string &line); + virtual bool checkArgs() = 0; + ~ACommand(); + ACommand(User *user, Channel *channel, Server *server, const std::string &line); }; class Invite; @@ -58,3 +69,5 @@ namespace cmd class Unknown; class User; }; + +#include "./commands/commands.tpp"