ClemaX / ft_irc

Internet Relay Chat Server
0 stars 0 forks source link

Nickname Collision #21

Closed ClemaX closed 3 years ago

ClemaX commented 3 years ago

The server should check for nickname collision upon receiving the NICK command. Check ERR_NICKCOLLISION and KILL.

~Freenode~ The irc client adds _ to the end of the nickname until the collision is resolved. This does not need to be handled server side.

pablo-lamtenzan commented 3 years ago

I'll do this. With which client should i test ?

pablo-lamtenzan commented 3 years ago

I got this code:

// Need to know where the nickname is parsed/processed

# include <string>
# include <irc/Database.hpp>

/**
 *  @brief Return an avalaible (not collisioned) client nickname,
 *  append a '_' for each collision found.
 *
 *  @tparam db A template representing a database that has the
 *  member: bool_conversible_type get_client(const std::string&)
 *  @param nickname Reseach key.
 *  @param database The database where the search will be performed.
 *
 *  @return A valid nickname.
*/
template <typename db>
const std::string& set_nickname(const std::string& nickname, const db& database)
{ return (database.getClient(nickname) ? set_nickname(nickname + "_", database) : nickname); }

But i don't able to find where use it. I don't find where the nick command is implemented. Can u help me with that ?

ClemaX commented 3 years ago

It should be in the server commands, or maybe it is not implemented yet.

pablo-lamtenzan commented 3 years ago

The NICK command (guiding my research by functions and classes names) seem to not be present in the folder src/irc/commands. I going to ask to Brice and implement it too if is not done yet.

pablo-lamtenzan commented 3 years ago

DONE