diff --git a/ircserv b/ircserv new file mode 100755 index 0000000..c3577f1 Binary files /dev/null and b/ircserv differ diff --git a/srcs/server/addNewClient.cpp b/srcs/server/addNewClient.cpp index 59632de..7ea6be9 100644 --- a/srcs/server/addNewClient.cpp +++ b/srcs/server/addNewClient.cpp @@ -18,7 +18,6 @@ const std::string extractCommandContent(const std::string &buffer, const std::st int Server::checkIfNewClient(const char *buffer, int client_fd) { - if (isValidFd(client_fd) == -1) return (-1); if (_clients.count(client_fd)) diff --git a/srcs/server/commands/nick.cpp b/srcs/server/commands/nick.cpp index 8c79077..afc5367 100644 --- a/srcs/server/commands/nick.cpp +++ b/srcs/server/commands/nick.cpp @@ -34,7 +34,7 @@ int Server::checkNickUser(int client_fd, const std::string &nick) int i = 0; int j = 0; - while (user[i] != ' ') + while (user[i] && user[i] != ' ') i++; const std::string userFirstParam(user.substr(j, i)); diff --git a/srcs/server/numericReplies.hpp b/srcs/server/numericReplies.hpp index 792e025..3a86b37 100644 --- a/srcs/server/numericReplies.hpp +++ b/srcs/server/numericReplies.hpp @@ -22,7 +22,7 @@ # define ERR_CHANNELISFULL(channel) ":localhost 471" + channel + " :Cannot join channel (+l)" # define RPL_TOPIC(channel, topic) ":localhost 332 " + channel + " :" + topic # define RPL_NAMREPLY(username, channel, nickname) ":localhost 353 " + username + " " + channel + ":" + "awd awdd ddwa cawca" + "\r\n" -# define ERR_CHANOPRIVSNEEDED(channel) ":localhost 482" + channel + " :You're not channel operator" +# define ERR_CHANOPRIVSNEEDED(nickname, channel) ":localhost/6666 482 " + nickname + " " + channel + " :You're not channel operator" # define ERR_NICKNAMEINUSE(nickname) ":localhost 433 " + nickname + ":Nickname already in use" # define RPL_NICK(oldnick, newnick) ":" + oldnick + " NICK " + newnick + "\r\n" diff --git a/srcs/server/numeric_replies.hpp b/srcs/server/numeric_replies.hpp index aacf294..e69de29 100644 --- a/srcs/server/numeric_replies.hpp +++ b/srcs/server/numeric_replies.hpp @@ -1,14 +0,0 @@ - -#pragma once - -#include "Server.hpp" - -//------------------*ERROR-JOIN----------------------- - -# define ERR_NEEDMOREPARAMS(command) ":localhost 461 " + command + " :not enough parameters\r\n" -# define ERR_INVITEONLYCHAN(nickname) ":localhost 473 " + nickname + ":Cannot join channel (+i)\r\n" -# define ERR_NOSUCHCHANNEL(nickname) ":localhost " + nickname + "number of params invalid\r\n" -# define ERR_CHANNELISFULL(channel) ":localhost " + channel + " :Cannot join channel (+l)\r\n" -# define RPL_TOPIC(channel, topic) ":localhost 332 " + channel + " :" + topic + "\r\n" -# define RPL_NAMREPLY(username, channel, nickname) ":localhost 353 " + username + " " + channel + ":" + "\r\n" -# define ERR_CHANOPRIVSNEEDED(nickname, channel) ":localhost/6666 482 " + nickname + " " + channel + " :You're not channel operator"