fix nickstealing

This commit is contained in:
reality 2014-09-09 09:52:45 +00:00
parent 402c8e80f4
commit 77d9997009

View File

@ -107,10 +107,12 @@ var users = function(dbot) {
// Update current nick
this.api.resolveUser(event.server, event.user, function(err, user) {
if(user) {
this.internalAPI.updateCurrentNick(user, event.newNick, function(){});
this.api.resolveUser(event.server, event.newNick, function(err, eUser) {
if(!eUser) {
this.internalAPI.createAlias(event.newNick, user, function(){});
this.internalAPI.updateCurrentNick(user, event.newNick, function(){});
} else if(user.id === eUser.id) {
this.internalAPI.updateCurrentNick(user, event.newNick, function(){});
}
}.bind(this));
}