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

Commit

Permalink
Add IRC Banned Nicks feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruoshi.Ling committed Aug 29, 2015
1 parent c421f1a commit e07b8d6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ config.users = {
'ircuser': 'slackuser'
};

// Baned list of IRC Nicks
config.bannedIRCNicks = [
'<IRC Nick>',
'ircNick'
];

// -- Setting end on this line

App( config ).start();
Expand Down
6 changes: 6 additions & 0 deletions README_zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ config.users = {
'ircuser': 'slackuser'
};

// IRC 暱稱黑名單
config.bannedIRCNicks = [
'<IRC 暱稱>',
'ircNick'
];

// -- 到此行結束設定。

App( config ).start();
Expand Down
4 changes: 4 additions & 0 deletions config.js.sample
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ config.users = {
'ircAccount': 'slackUser'
};

config.bannedIRCNicks = [
'ircNick'
];

App( config ).start();
5 changes: 5 additions & 0 deletions lib/irc-to-slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var IrcToSlack = function(config) {
}

this.config = _.defaults(config, {
'bannedIRCNicks': []
});

return this;
Expand All @@ -29,6 +30,10 @@ IrcToSlack.prototype._sentToSlack = function(type, from, to, message) {
var hasAvatar = false;
var isNickExist = !!this.nameMap.getSlackNameByIrcNick(from);

if (_.contains(this.config.bannedIRCNicks, username)) {
return;
}

if (this.config.isMapName && isNickExist) {
username = this.nameMap.getSlackNameByIrcNick(from);
hasAvatar = typeof avatars[username] !== 'undefined';
Expand Down

0 comments on commit e07b8d6

Please sign in to comment.