revert to older, non-broken ignore. whoops!

This commit is contained in:
reality 2013-01-22 19:33:22 +00:00
parent 7d744ef849
commit f7acd2e01b

View File

@ -9,9 +9,8 @@ var _ = require('underscore')._;
var ignore = function(dbot) { var ignore = function(dbot) {
var commands = { var commands = {
'~ignore': function(event) { '~ignore': function(event) {
var user = dbot.api.users.resolveUser(event.server, event.user), var module = event.params[1];
module = event.params[1], var ignorableModules = _.chain(dbot.modules)
ignorableModules = _.chain(dbot.modules)
.filter(function(module, name) { .filter(function(module, name) {
return dbot.config[module].ignorable === true; return dbot.config[module].ignorable === true;
}) })
@ -25,13 +24,13 @@ var ignore = function(dbot) {
})); }));
} else { } else {
if(_.include(ignorableModules, module)) { if(_.include(ignorableModules, module)) {
if(_.has(dbot.db.ignores, user) && _.include(dbot.db.ignores[user], module)) { if(_.has(dbot.db.ignores, event.user) && _.include(dbot.db.ignores[event.user], module)) {
event.reply(dbot.t('already_ignoring', { 'user': event.user })); event.reply(dbot.t('already_ignoring', { 'user': event.user }));
} else { } else {
if(_.has(dbot.db.ignores, module)) { if(_.has(dbot.db.ignores, module)) {
dbot.db.ignores[user].push(module); dbot.db.ignores[event.user].push(module);
} else { } else {
dbot.db.ignores[user] = [module]; dbot.db.ignores[event.user] = [module];
} }
dbot.instance.ignoreTag(event.user, module); dbot.instance.ignoreTag(event.user, module);
@ -47,13 +46,11 @@ var ignore = function(dbot) {
}, },
'~unignore': function(event) { '~unignore': function(event) {
var user = dbot.api.users.resolveUser(event.server, event.user), var ignoredModules = [];
module = event.params[1],
ignoredModules = [];
if(_.has(dbot.db.ignores, event.user)) { if(_.has(dbot.db.ignores, event.user)) {
ignoredModules = dbot.db.ignores[user]; ignoredModules = dbot.db.ignores[event.user];
} }
var module = event.params[1];
if(_.isUndefined(module)) { if(_.isUndefined(module)) {
event.reply(dbot.t('unignore_usage', { event.reply(dbot.t('unignore_usage', {
@ -62,8 +59,8 @@ var ignore = function(dbot) {
})); }));
} else { } else {
if(_.include(ignoredModules, module)) { if(_.include(ignoredModules, module)) {
dbot.db.ignores[user].splice(dbot.db.ignores[user].indexOf(module), 1); dbot.db.ignores[event.user].splice(dbot.db.ignores[event.user].indexOf(module), 1);
dbot.instance.removeIgnore(user, module) dbot.instance.removeIgnore(event.user, module)
event.reply(dbot.t('unignored', { event.reply(dbot.t('unignored', {
'user': event.user, 'user': event.user,
'module': module 'module': module