fix up the nick before action fix. this should be more efficient (plus it is prettier)

This commit is contained in:
reality 2014-01-04 03:51:31 +00:00
parent 023dafc4cb
commit b9926a154c
2 changed files with 8 additions and 18 deletions

2
jsbot

@ -1 +1 @@
Subproject commit d57af91f9d623c66eedcaccc8c6f6632d5e36755
Subproject commit 5a67080aedbf347252f0374fcfbae4992be80da2

View File

@ -96,7 +96,6 @@ 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 ]);
@ -190,7 +189,7 @@ var users = function(dbot) {
}
}.bind(this);
if(event.user && event.channel && _.include(['JOIN', 'MODE', 'PRIVMSG'], event.action)) {
if(event.user && event.channel && _.include(['JOIN', 'MODE', 'NICK', 'PRIVMSG'], event.action)) {
checkChannel(function(channel) {
event.rChannel = channel;
checkUser(function(user) {
@ -202,24 +201,15 @@ var users = function(dbot) {
this.userCache[event.server][event.rUser.currentNick] = event.rUser.id;
}
checkChannelUsers(function() {
callback();
});
}.bind(this));
}.bind(this));
} else if(event.user) {
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;
checkChannelUsers(function() {
callback();
});
} else {
callback();
}
}.bind(this));
}.bind(this));
} else {
callback();
}