Reset nickname in UI back to previous one on error

This commit is contained in:
Pavel Djundik 2016-10-01 19:46:36 +03:00 committed by Jérémie Astori
parent 4328946f80
commit beb6d1ea5b

View file

@ -28,6 +28,11 @@ module.exports = function(irc, network) {
var random = (data.nick || irc.user.nick) + Math.floor(10 + (Math.random() * 89));
irc.changeNick(random);
}
client.emit("nick", {
network: network.id,
nick: irc.user.nick
});
});
irc.on("nick invalid", function(data) {
@ -42,5 +47,10 @@ module.exports = function(irc, network) {
var random = "i" + Math.random().toString(36).substr(2, 10); // 'i' so it never begins with a number
irc.changeNick(random);
}
client.emit("nick", {
network: network.id,
nick: irc.user.nick
});
});
};