Project

General

Profile

Bug #20

Handle Numeric Reply 433 ERR_NICKNAMEINUSE properly

Added by EgS almost 13 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
-
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Version:
0.13.0
OS:
Any

Description

Use numeric Reply 433 to check whether or not a NICK command was successfull.

Currently the own nick is determined by 001 (RPL_WELCOME) which isn't even sent if the desired nick is already taken.

In this context the following numeric replies should be implemented too:
431 ERR_NONICKNAMEGIVEN
432 ERR_ERRONEUSNICKNAME
436 ERR_NICKCOLLISION

Additional information:

RFC:

431    ERR_NONICKNAMEGIVEN
":No nickname given"
- Returned when a nickname parameter expected for a
command and isn't found.
432    ERR_ERRONEUSNICKNAME
"<nick> :Erroneous nickname"
- Returned after receiving a NICK message which contains
characters which do not fall in the defined set. See
section 2.3.1 for details on valid nicknames.
433    ERR_NICKNAMEINUSE
"<nick> :Nickname is already in use"
- Returned when a NICK message is processed that results
in an attempt to change to a currently existing
nickname.
436    ERR_NICKCOLLISION
"<nick> :Nickname collision KILL from <user>@<host>"
- Returned by a server to a client when it detects a
nickname collision (registered of a NICK that
already exists by another server).

History

#1 Updated by EgS almost 13 years ago

433 is done

/* RPL_NICKNAMEINUSER */
void Server::handleServer433(QString prefix, QStringList params) {
QString errnick = params0;
emit displayMsg(Message::error("", tr("Nick %1 is already taken").arg(errnick)));
// if there is a problem while connecting to the server -> we handle it
// TODO rely on another source...
if(currentServer.isEmpty()) {
QStringList desiredNicks = identity["NickList"].toStringList();
int nextNick = desiredNicks.indexOf(errnick) + 1;
if (desiredNicks.size() > nextNick) {
putCmd("NICK", QStringList(desiredNicks[nextNick]));
} else {
emit displayMsg(Message::error("", "All nicks in nicklist taken... use: /nick <othernick> to continue"));
}
}
}

#2 Updated by EgS almost 13 years ago

432 is done as well as possible

/* ERR_ERRONEUSNICKNAME */
void Server::handleServer432(QString prefix, QStringList params) {
if(params.size() < 2) {
// handle unreal-ircd bug, where unreal ircd doesnt supply a TARGET in ERR_ERRONEUSNICKNAME during registration phase:
// nick @
// :irc.scortum.moep.net 432 @ :Erroneous Nickname: Illegal characters
// correct server reply:
// :irc.scortum.moep.net 432 * @ :Erroneous Nickname: Illegal characters
emit displayMsg(Message::Error, "", tr("There is a nickname in your identity's nicklist which contains illegal characters"));
emit displayMsg(Message::Error, "", tr("Due to a bug in Unreal IRCd (and maybe other irc-servers too) we're unable to determine the erroneous nick"));
emit displayMsg(Message::Error, "", tr("Please use: /nick <othernick> to continue or clean up your nicklist"));
} else {
QString errnick = params0;
emit displayMsg(Message::Error, "", tr("Nick %1 contains illegal characters").arg(errnick));
// if there is a problem while connecting to the server -> we handle it
// TODO rely on another source...
if(currentServer.isEmpty()) {
QStringList desiredNicks = identity["NickList"].toStringList();
int nextNick = desiredNicks.indexOf(errnick) + 1;
if (desiredNicks.size() > nextNick) {
putCmd("NICK", QStringList(desiredNicks[nextNick]));
} else {
emit displayMsg(Message::Error, "", tr("No free and valid nicks in nicklist found. use: /nick <othernick> to continue"));
}
}
}
}

431 ERR_NONICKNAMEGIVEN and
436 ERR_NICKCOLLISION

don't need special treatment, since there is now way to encounter those errors and emptynicks aren't possible in preferred nicklist - at least I hope and suppose that it's not possible :)

#3 Updated by EgS over 12 years ago

Fix has been live for a while...
No complaints so far -> close

Also available in: Atom PDF