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>> {
|
package "CommandDispatcher" <<namespace>> {
|
||||||
class CommandDispatcher {
|
class CommandDispatcher {
|
||||||
+ dispatchCommand(user : User, line : string) : void
|
+ dispatchCommand(user : *User, channel : *channel, line : string) : void
|
||||||
+ splitCommand(line : string) : vector<string>
|
+ splitCommand(line : string) : vector<string>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/05/20 23:31:58 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 <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "user.hpp"
|
#include "user.hpp"
|
||||||
|
#include "channel.hpp"
|
||||||
|
|
||||||
namespace cmd
|
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);
|
std::vector<std::string> split(const std::string &line);
|
||||||
|
|
||||||
class ACommand {
|
class ICommand {
|
||||||
private:
|
private:
|
||||||
std::string _command;
|
std::string _command;
|
||||||
std::vector<std::string> _args;
|
std::vector<std::string> _args;
|
||||||
User _user;
|
User _user;
|
||||||
public:
|
public:
|
||||||
virtual bool execute() = 0;
|
virtual void execute() = 0;
|
||||||
~ACommand();
|
~ICommand();
|
||||||
ACommand(User user, const std::string &line);
|
ICommand(User *user, Channel *channel, const std::string &line);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Invite;
|
class Invite;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue