3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-18 00:22:35 +01:00
This commit is contained in:
Luke Slater 2015-01-29 21:42:09 +00:00
parent 79a607ba1b
commit 57b6b1b7ee

View File

@ -51,11 +51,13 @@ console.log('removing ' + uPart);
var offlineOps = {}; var offlineOps = {};
async.each(ops, function(op, done) { async.each(ops, function(op, done) {
dbot.api.users.isOnline(server, cName, op, function(err, user, online) { dbot.api.users.isOnline(server, cName, op, function(err, user, online) {
if(user) {
if(!err && !online) offlineOps[op] = user; if(!err && !online) offlineOps[op] = user;
if(user.currentNick !== op) { if(user.currentNick !== op) {
ops = _.without(ops, op); ops = _.without(ops, op);
ops.push(user.currentNick); ops.push(user.currentNick);
} }
}
done(); done();
}); });
}, function() { }, function() {
@ -92,31 +94,12 @@ console.log('removing ' + uPart);
} }
}, this); }, this);
ops = _.pluck(ops, 'name'); ops = _.pluck(ops, 'name');
message = this.internalAPI.formatNotify(type, server,
dbot.api.users.resolveChannel(server, cName, function(channel) { user, cName, message);
if(channel) { this.internalAPI.notify(server, ops, message);
var perOps = channel.op; if(_.has(this.config.chan_redirs, cName)) {
if(this.config.notifyVoice) perOps = _.union(perOps, channel.voice); dbot.say(server, this.config.chan_redirs[cName], message);
}
this.db.read('nunsubs', cName + '.' + server, function(err, nunsubs) {
async.eachSeries(ops, function(nick, next) {
dbot.api.users.resolveUser(server, nick, function(user) {
if(nunsubs && _.include(nunsubs.users, user.id)) {
ops = _.without(ops, user.currentNick);
}
next();
});
}, function() {
message = this.internalAPI.formatNotify(type, server,
user, cName, message);
this.internalAPI.notify(server, ops, message);
if(_.has(this.config.chan_redirs, cName)) {
dbot.say(server, this.config.chan_redirs[cName], message);
}
}.bind(this));
}.bind(this));
}
}.bind(this));
} }
}, },