forked from Hri7566/mpp-server-dev2
parity
This commit is contained in:
parent
2d0fd503b4
commit
12b6c6b0e4
|
@ -647,6 +647,20 @@ class Channel extends EventEmitter {
|
|||
})
|
||||
}
|
||||
|
||||
unban(_id) {
|
||||
this.connections.filter((usr) => usr.participantId == user.participantId).forEach(u => {
|
||||
if (user.bantime) {
|
||||
delete user.bantime;
|
||||
}
|
||||
|
||||
if (user.bannedtime) {
|
||||
delete user.bannedtime;
|
||||
}
|
||||
|
||||
this.bans.delete(user.user._id);
|
||||
});
|
||||
}
|
||||
|
||||
Notification(who, title, text, html, duration, target, klass, id) {
|
||||
new Notification({
|
||||
id: id,
|
||||
|
|
|
@ -212,10 +212,12 @@ module.exports = (cl) => {
|
|||
});
|
||||
|
||||
cl.on('kickban', msg => {
|
||||
if (cl.channel.crown == null) return;
|
||||
if (!(cl.channel && cl.participantId)) return;
|
||||
if (!cl.channel.crown.userId) return;
|
||||
if (!(cl.user._id == cl.channel.crown.userId)) return;
|
||||
if (!admin) {
|
||||
if (cl.channel.crown == null) return;
|
||||
if (!(cl.channel && cl.participantId)) return;
|
||||
if (!cl.channel.crown.userId) return;
|
||||
if (!(cl.user._id == cl.channel.crown.userId)) return;
|
||||
}
|
||||
if (msg.hasOwnProperty('_id') && typeof msg._id == "string") {
|
||||
if (!cl.quotas.kickban.attempt() && !admin) return;
|
||||
let _id = msg._id;
|
||||
|
@ -224,6 +226,20 @@ module.exports = (cl) => {
|
|||
}
|
||||
});
|
||||
|
||||
cl.on('unban', (msg, admin) => {
|
||||
if (!admin) {
|
||||
if (cl.channel.crown == null) return;
|
||||
if (!(cl.channel && cl.participantId)) return;
|
||||
if (!cl.channel.crown.userId) return;
|
||||
if (!(cl.user._id == cl.channel.crown.userId)) return;
|
||||
}
|
||||
if (msg.hasOwnProperty('_id') && typeof msg._id == "string") {
|
||||
if (!cl.quotas.kickban.attempt() && !admin) return;
|
||||
let _id = msg._id;
|
||||
cl.channel.unban(_id);
|
||||
}
|
||||
});
|
||||
|
||||
cl.on("bye", msg => {
|
||||
cl.user.stopFlagEvents();
|
||||
cl.destroy();
|
||||
|
|
Loading…
Reference in New Issue