mirror of
https://github.com/reality/dbot.git
synced 2024-12-28 05:32:50 +01:00
fix ignore for multiple nicks and whatever
This commit is contained in:
parent
36aab19204
commit
62efc4b2b9
@ -276,7 +276,7 @@ var ignore = function(dbot) {
|
||||
dbot.api.users.getUser(ignores.id, function(user) {
|
||||
if(user) {
|
||||
_.each(ignores.ignores, function(module) {
|
||||
dbot.instance.ignoreTag(user.primaryNick, module);
|
||||
dbot.instance.ignoreTag(user.currentNick, module);
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -287,7 +287,18 @@ var ignore = function(dbot) {
|
||||
dbot.instance.ignoreTag(channel.name, module);
|
||||
});
|
||||
}, function(err) { });
|
||||
};
|
||||
|
||||
dbot.api.event.addHook('new_current_nick', function(user, oldNick) {
|
||||
this.api.getUserIgnores(user, function(err, ignores) {
|
||||
if(ignores) {
|
||||
_.each(ignores.ignores, function(module) {
|
||||
dbot.instance.removeIgnore(oldNick, module);
|
||||
dbot.instance.ignoreTag(user.currentNick, module);
|
||||
});
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
exports.fetch = function(dbot) {
|
||||
|
@ -103,7 +103,10 @@ var users = function(dbot) {
|
||||
}
|
||||
|
||||
this.db.save('users', event.rUser.id, event.rUser, function(err) {
|
||||
dbot.api.event.emit('new_user_alias', [ event.rUser, event.newNick ]);
|
||||
if(!isKnown) {
|
||||
dbot.api.event.emit('new_user_alias', [ event.rUser, event.newNick ]);
|
||||
}
|
||||
dbot.api.event.emit('new_current_nick', [ event.rUser, event.user ]);
|
||||
});
|
||||
}.bind(this));
|
||||
}.bind(this);
|
||||
@ -137,9 +140,10 @@ var users = function(dbot) {
|
||||
this.internalAPI.createUser(event.server, event.user, done);
|
||||
} else {
|
||||
if(event.user !== user.currentNick) {
|
||||
var oldNick = user.currentNick;
|
||||
user.currentNick = event.user;
|
||||
this.db.save('users', user.id, user, function() {
|
||||
dbot.api.event.emit('new_current_nick', [ user ]);
|
||||
dbot.api.event.emit('new_current_nick', [ user, oldNick ]);
|
||||
done(user);
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user