Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Beta version #22

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make banned nicks and keywords case-insensitive
  • Loading branch information
Ruoshi.Ling committed Aug 29, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 4d2942e8b44baccc867899f1e1e4a8691ad6a055
7 changes: 5 additions & 2 deletions lib/irc-to-slack.js
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@ var IrcToSlack = function(config) {
'bannedKeywords': []
});

this.config.bannedIRCNicks = this.config.bannedIRCNicks.join('|').toLowerCase().split('|');
this.config.bannedKeywords = 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;
}
}