Doing it live

This commit is contained in:
calzoneman 2014-09-13 00:01:54 -05:00
parent d2027d2e5a
commit 309e5d8b46
3 changed files with 22 additions and 1 deletions

View File

@ -183,3 +183,5 @@ channel-blacklist: []
# * ffmpeg must be installed on the server # * ffmpeg must be installed on the server
ffmpeg: ffmpeg:
enabled: false enabled: false
link-domain-blacklist: []

View File

@ -1,3 +1,4 @@
var Config = require("../config");
var User = require("../user"); var User = require("../user");
var XSS = require("../xss"); var XSS = require("../xss");
var ChannelModule = require("./module"); var ChannelModule = require("./module");
@ -215,6 +216,15 @@ ChatModule.prototype.handlePm = function (user, data) {
}; };
ChatModule.prototype.processChatMsg = function (user, data) { ChatModule.prototype.processChatMsg = function (user, data) {
if (data.msg.match(Config.get("link-domain-blacklist-regex"))) {
this.channel.logger.log(user.displayip + " (" + user.getName() + ") was kicked for " +
"blacklisted domain");
user.kick();
this.sendModMessage(user.getName() + " was kicked: blacklisted domain in " +
"chat message", 2);
return;
}
if (data.msg.indexOf("/afk") === -1) { if (data.msg.indexOf("/afk") === -1) {
user.setAFK(false); user.setAFK(false);
} }

View File

@ -105,7 +105,8 @@ var defaults = {
"channel-blacklist": [], "channel-blacklist": [],
ffmpeg: { ffmpeg: {
enabled: false enabled: false
} },
"link-domain-blacklist": []
}; };
/** /**
@ -333,6 +334,14 @@ function preprocessConfig(cfg) {
}); });
cfg["channel-blacklist"] = tbl; cfg["channel-blacklist"] = tbl;
if (cfg["link-domain-blacklist"].length > 0) {
cfg["link-domain-blacklist-regex"] = new RegExp(
cfg["link-domain-blacklist"].join("|").replace(/\./g, "\\."), "gi");
} else {
// Match nothing
cfg["link-domain-blacklist-regex"] = new RegExp("$^", "gi");
}
return cfg; return cfg;
} }