diff --git a/modules/atheme/atheme.js b/modules/atheme/atheme.js index 0dc0c9c..ecd76bf 100644 --- a/modules/atheme/atheme.js +++ b/modules/atheme/atheme.js @@ -40,12 +40,13 @@ var atheme = function(dbot) { } else { this.hostStack[server][mask] = { 'users': [], - 'callbacks': [ callback ] + 'callbacks': [ callback ], + 'timeout': null }; } dbot.say(server, 'hostserv', 'LISTVHOST ' + mask); - setTimeout(function() { // Delete callback if no response + this.hostStack[server][mask].timeout = setTimeout(function() { // Delete callback if no response if(_.has(this.hostStack[server], mask)) { _.each(this.hostStack[server][mask].callbacks, function(callback) { callback(true, null); @@ -124,6 +125,7 @@ var atheme = function(dbot) { _.each(this.hostStack[event.server][mask].callbacks, function(callback) { callback(null, this.hostStack[event.server][mask].users); }, this); + clearTimeout(this.hostStack[event.server][mask].timeout); delete this.hostStack[event.server][mask]; } }