Closed treeform closed 12 years ago
Thanks, I'll check it out
I have changed the nick function to this, it looks like its working:
NICK: function(user, nick) {
var oldMask = user.mask;
if (!nick || nick.length === 0) {
return user.send(this.host, irc.errors.noNickGiven, ':No nickname given');
} else if (nick === user.nick) {
return;
} else if (nick.length > 9 || nick.match(irc.validations.invalidNick)) {
return user.send(this.host, irc.errors.badNick, (user.nick || ''), nick, ':Erroneus nickname');
} else if (this.valueExists(nick, this.users.registered, 'nick')) {
return user.send(this.host, irc.errors.nameInUse, '*', nick, ':is already in use');
}
nick = nick.trim();
// send the the fact that your name changed to yourself first
user.send(user.mask, 'NICK', ':' + nick);
user.channels.forEach(function(channel) {
channel.send(user.mask, 'NICK', ':' + nick);
});
user.nick = nick;
user.register();
},
Yep, that works, I'll release an update with that in
Repro: start server join with two clients do not join any channels! /msg eash other change /nick on one of the clients now that client cant be msged any more
The irc client gets confused to what the user's nick is because the change nick command is not sent to it.
In this code:
NICK: function(user, nick) { ..... user.channels.forEach(function(channel) { channel.send(user.mask, 'NICK', ':' + nick); });
The new nick command is only sent to channels that nick is in. But if the users is not in any channels he never gets the command that he got the new nick.
I am not sure how to send nick changed command directly to client, i tried this: user.send(user.mask, 'NICK', ':' + nick);
but it does not seem to work.