working flag

This commit is contained in:
reality 2015-07-07 18:17:10 +00:00
parent 24aaf298f7
commit 050fa88e47

View File

@ -18,13 +18,14 @@ var atheme = function(dbot) {
this.flagStack[server][channel] = { this.flagStack[server][channel] = {
'flags': {}, 'flags': {},
'callbacks': [ callback ], 'callbacks': [ callback ],
'timeout': null 'timeout': null,
'working': false
}; };
} }
dbot.say(server, 'chanserv', 'FLAGS ' + channel); dbot.say(server, 'chanserv', 'FLAGS ' + channel);
this.flagStack[server][channel].timeout = setTimeout(function() { // Delete callback if no response this.flagStack[server][channel].timeout = setTimeout(function() { // Delete callback if no response
if(_.has(this.flagStack[server], channel)) { if(_.has(this.flagStack[server], channel) && this.flagStack[server][channel].working == false) {
_.each(this.flagStack[server][channel].callbacks, function(callback) { _.each(this.flagStack[server][channel].callbacks, function(callback) {
callback(true, null); callback(true, null);
}); });
@ -87,6 +88,7 @@ var atheme = function(dbot) {
this.flagStack[event.server][flags[4]].flags[flags[2]] = flags[3]; this.flagStack[event.server][flags[4]].flags[flags[2]] = flags[3];
} else if(end) { } else if(end) {
if(_.has(this.flagStack[event.server], end[1])) { if(_.has(this.flagStack[event.server], end[1])) {
this.flagStack[event.server][end[1]].working = true;
// Parse wildcard hostmasks to nicks // Parse wildcard hostmasks to nicks
var allFlags = this.flagStack[event.server][end[1]].flags, var allFlags = this.flagStack[event.server][end[1]].flags,
hostMasks = {}; hostMasks = {};