fix aliasing

This commit is contained in:
reality 2013-12-31 16:06:19 +00:00
parent 130113db50
commit 02d18245c3

View File

@ -96,6 +96,7 @@ var users = function(dbot) {
this.listener = function(event) { this.listener = function(event) {
this.api.isKnownUser(event.server, event.newNick, function(isKnown) { this.api.isKnownUser(event.server, event.newNick, function(isKnown) {
console.log(event.rUser);
event.rUser.currentNick = event.newNick; event.rUser.currentNick = event.newNick;
dbot.api.event.emit('new_current_nick', [ event.rUser ]); dbot.api.event.emit('new_current_nick', [ event.rUser ]);
@ -207,22 +208,20 @@ var users = function(dbot) {
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));
} else if(event.user) { } else if(event.user) {
checkUser(function(user) { // TODO: remove code repeating (is there any reason we can't do this in the first place hmm) this.api.resolveUser(event.server, event.user, function(user) {
event.rUser = user; if(user) event.rUser = user;
if(!_.has(this.userCache[event.server], event.rUser.currentNick)) {
this.userCache[event.server][event.rUser.currentNick] = event.rUser.id;
} else if(this.userCache[event.server][event.rUser.currentNick] != event.rUser.id) {
this.userCache[event.server][event.rUser.currentNick] = event.rUser.id;
}
if(event.channel) { if(event.channel) {
this.api.resolveChannel(event.server, event.channel.name, function(channel) { this.api.resolveChannel(event.server, event.channel.name, function(channel) {
if(channel) event.rChannel = channel; if(channel) event.rChannel = channel;
callback(); callback();
}); });
} else {
callback();
} }
}.bind(this)); }.bind(this));
} else {
callback();
} }
}.bind(this)); }.bind(this));
}; };