diff --git a/lib/irc-to-slack.js b/lib/irc-to-slack.js index 7a31a73..535a2a9 100644 --- a/lib/irc-to-slack.js +++ b/lib/irc-to-slack.js @@ -14,6 +14,9 @@ var IrcToSlack = function(config) { 'bannedKeywords': [] }); + this.config.bannedIRCNicks.join('|').toLowerCase().split('|'); + this.config.bannedKeywords.join('|').toLowerCase().split('|'); + return this; }; @@ -32,12 +35,12 @@ IrcToSlack.prototype._sentToSlack = function(type, from, to, message) { var isNickExist = !!this.nameMap.getSlackNameByIrcNick(from); var bannedKeywords = this.config.bannedKeywords; - if (_.contains(this.config.bannedIRCNicks, username)) { + if (_.contains(this.config.bannedIRCNicks, username.toLowerCase())) { return; } for (var i=0, len=bannedKeywords.length; i < len; i++) { - if (message.toLowerCase().indexOf(bannedKeywords[i].toLowerCase()) > -1) { + if (message.toLowerCase().indexOf(bannedKeywords[i]) > -1) { return; } }