From 02d18245c321e20bf460d1d17248d040efc5203d Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 31 Dec 2013 16:06:19 +0000 Subject: [PATCH] fix aliasing --- modules/users/users.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/users/users.js b/modules/users/users.js index 71ae25b..e92e46a 100644 --- a/modules/users/users.js +++ b/modules/users/users.js @@ -96,6 +96,7 @@ var users = function(dbot) { this.listener = function(event) { this.api.isKnownUser(event.server, event.newNick, function(isKnown) { + console.log(event.rUser); event.rUser.currentNick = event.newNick; dbot.api.event.emit('new_current_nick', [ event.rUser ]); @@ -207,22 +208,20 @@ var users = function(dbot) { }.bind(this)); }.bind(this)); } 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) - 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; - } + this.api.resolveUser(event.server, event.user, function(user) { + if(user) event.rUser = user; if(event.channel) { this.api.resolveChannel(event.server, event.channel.name, function(channel) { if(channel) event.rChannel = channel; callback(); }); + } else { + callback(); } }.bind(this)); + } else { + callback(); } }.bind(this)); };