feat(commands): channel required to send to command part
This commit is contained in:
parent
c7d826e738
commit
1f96596130
2 changed files with 15 additions and 7 deletions
|
|
@ -86,7 +86,7 @@ class Channel {
|
|||
' ====================================
|
||||
package "CommandDispatcher" <<namespace>> {
|
||||
class CommandDispatcher {
|
||||
+ dispatchCommand(user : User, line : string) : void
|
||||
+ dispatchCommand(user : *User, channel : *channel, line : string) : void
|
||||
+ splitCommand(line : string) : vector<string>
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <string>
|
||||
#include <vector>
|
||||
#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<std::string> split(const std::string &line);
|
||||
|
||||
class ACommand {
|
||||
class ICommand {
|
||||
private:
|
||||
std::string _command;
|
||||
std::vector<std::string> _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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue