From 6d28aa272bb2dc7be95176927a26e6443759b761 Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 29 Dec 2013 11:09:00 +0000 Subject: [PATCH] fix NICK without talking --- modules/users/users.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/users/users.js b/modules/users/users.js index a96979c..71ae25b 100644 --- a/modules/users/users.js +++ b/modules/users/users.js @@ -189,7 +189,7 @@ var users = function(dbot) { } }.bind(this); - if(event.user && event.channel && _.include(['JOIN', 'MODE', 'PRIVMSG', 'NICK'], event.action)) { + if(event.user && event.channel && _.include(['JOIN', 'MODE', 'PRIVMSG'], event.action)) { checkChannel(function(channel) { event.rChannel = channel; checkUser(function(user) { @@ -207,15 +207,20 @@ var users = function(dbot) { }.bind(this)); }.bind(this)); } else if(event.user) { - this.api.resolveUser(event.server, event.user, function(user) { - if(user) event.rUser = 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; + } + if(event.channel) { this.api.resolveChannel(event.server, event.channel.name, function(channel) { if(channel) event.rChannel = channel; callback(); }); - } else { - callback(); } }.bind(this)); }