3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 04:02:39 +01:00

getUserHost callbacks false if response not received in timely manner [Close #501]

This commit is contained in:
reality 2013-06-10 16:13:30 +00:00
parent ab520e625a
commit 0544bb9d12

View File

@ -18,6 +18,9 @@ var nickserv = function(dbot) {
if(!_.has(this.userStack, server)) this.userStack[server] = {}; if(!_.has(this.userStack, server)) this.userStack[server] = {};
this.userStack[server][nick] = callback; this.userStack[server][nick] = callback;
dbot.instance.connections[server].send('USERHOST ' + nick); dbot.instance.connections[server].send('USERHOST ' + nick);
setTimeout(function() {
if(_.has(this.userStack[server], nick)) callback(false);
}.bind(this), 3000);
} }
}; };
@ -43,6 +46,7 @@ var nickserv = function(dbot) {
if(match[1]) match[1] = match[1].replace('\*', ''); if(match[1]) match[1] = match[1].replace('\*', '');
if(match && _.has(this.userStack, event.server) && _.has(this.userStack[event.server], match[1])) { if(match && _.has(this.userStack, event.server) && _.has(this.userStack[event.server], match[1])) {
this.userStack[event.server][match[1]](match[3].trim()); this.userStack[event.server][match[1]](match[3].trim());
delete this.userStack[event.server][match[1]];
} }
} }
}.bind(this); }.bind(this);