From 0544bb9d1240404166fe436bd36448ae6084ed2f Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 10 Jun 2013 16:13:30 +0000 Subject: [PATCH] getUserHost callbacks false if response not received in timely manner [Close #501] --- modules/nickserv/nickserv.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/nickserv/nickserv.js b/modules/nickserv/nickserv.js index 72abd24..2981d3e 100644 --- a/modules/nickserv/nickserv.js +++ b/modules/nickserv/nickserv.js @@ -18,6 +18,9 @@ var nickserv = function(dbot) { if(!_.has(this.userStack, server)) this.userStack[server] = {}; this.userStack[server][nick] = callback; 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 && _.has(this.userStack, event.server) && _.has(this.userStack[event.server], match[1])) { this.userStack[event.server][match[1]](match[3].trim()); + delete this.userStack[event.server][match[1]]; } } }.bind(this);