diff --git a/Server/Server.cpp b/Server/Server.cpp index f6457e1..15bfec9 100644 --- a/Server/Server.cpp +++ b/Server/Server.cpp @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* Server.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: iherman- > command; - std::map::iterator it = commands_.find(command); + std::map::iterator it = commands_.find(command); if (it == commands_.end()) { std::string message = "Error: command not found!\n"; @@ -162,7 +155,7 @@ void Server::parseCommand(User& client) client.clearBuffer(); return ; } - it->second(client, args); + (this->*(it->second))(client, args); client.clearBuffer(); } diff --git a/Server/Server.hpp b/Server/Server.hpp index c8cbc88..b87aea8 100644 --- a/Server/Server.hpp +++ b/Server/Server.hpp @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* Server.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: iherman- sockets_; std::map clients_; - std::map commands_; + std::map commands_; bool handleClient(User& client); @@ -51,6 +51,10 @@ class Server Server(const Server& other); Server &operator=(const Server& other); + // Commands + void pass_cmd(User &client, std::istringstream &ss); + + public: Server(); Server(int port, const std::string& password); diff --git a/cmds/pass.cpp b/cmds/pass.cpp index 5d5362b..7b409c2 100644 --- a/cmds/pass.cpp +++ b/cmds/pass.cpp @@ -6,7 +6,7 @@ /* By: aortigos password_ == args) - client->authenticated = true; + client.setAuthenticated(true); else { // Still need to find what server should reply to different errors - std::string res = "Invalid password"; + client.send("Invalid password\r\n"); send(client.getFd(), res.c_str(), res.size(), 0); } } \ No newline at end of file