diff --git a/Makefile b/Makefile index 6092931..9bcaac3 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ NAME = ircserv SRC = main.cpp Server/Server.cpp Client/Client.cpp \ Channel/Channel.cpp \ commands/pass.cpp commands/nick.cpp commands/user.cpp \ - commands/join.cpp + commands/join.cpp commands/privmsg.cpp OBJ = $(SRC:.cpp=.o) diff --git a/Server/Server.cpp b/Server/Server.cpp index febd771..2bded9b 100644 --- a/Server/Server.cpp +++ b/Server/Server.cpp @@ -156,4 +156,8 @@ void Server::parseCommand(int fd, std::string line) cmd_nick(fd, ss); else if (command == "USER") cmd_user(fd, ss); + else if (command == "JOIN") + cmd_join(fd, ss); + else if (command == "PRIVMSG") + cmd_privmsg(fd, ss); } \ No newline at end of file diff --git a/commands/join.cpp b/commands/join.cpp index 5cf336f..f2c975d 100644 --- a/commands/join.cpp +++ b/commands/join.cpp @@ -6,7 +6,7 @@ /* By: aortigos > channel; + std::getline(ss, message); + message += "\r\n" + + std::vector members = channels[channel].getMembers(); + + + // iterador para recorrer los miembros e ir enviandoles el mensaje + for (size_t i = 0; i < members.size(); i++) + { + if (members[i] != fd) + send(members[i], message.c_str(), message.size(), 0); + } + +} \ No newline at end of file