Remove bannedwords feature

Username word bans are now implemented in the lobby server
This commit is contained in:
Guangcong Luo
2014-07-16 23:39:51 -04:00
parent 03c94929fd
commit 716cd0578f
2 changed files with 0 additions and 38 deletions

1
.gitignore vendored
View File

@@ -2,7 +2,6 @@
/logs/*
/node_modules
npm-debug.log
/config/bannedwords.txt
# boilerplate #
###############

View File

@@ -268,38 +268,7 @@ Users.setOfflineGroup = function (name, group, force) {
return true;
};
/*********************************************************
* Banned words
*********************************************************/
var bannedWords = {};
function importBannedWords() {
fs.readFile('config/bannedwords.txt', function (err, data) {
if (err) return;
data = ('' + data).split("\n");
bannedWords = {};
for (var i = 0; i < data.length; i++) {
if (!data[i]) continue;
bannedWords[data[i]] = true;
}
});
}
function exportBannedWords() {
fs.writeFile('config/bannedwords.txt', Object.keys(bannedWords).join('\n'));
}
function addBannedWord(word) {
bannedWords[word] = true;
exportBannedWords();
}
function removeBannedWord(word) {
delete bannedWords[word];
exportBannedWords();
}
importBannedWords();
Users.importUsergroups = importUsergroups;
Users.addBannedWord = addBannedWord;
Users.removeBannedWord = removeBannedWord;
/*********************************************************
* User and Connection classes
@@ -652,12 +621,6 @@ var User = (function () {
this.send('|nametaken|' + "|You did not specify a name.");
return false;
} else {
for (var w in bannedWords) {
if (userid.indexOf(w) >= 0) {
this.send('|nametaken|' + "|That name contains a banned word or phrase.");
return false;
}
}
if (userid === this.userid && !auth) {
return this.forceRename(name, this.authenticated, this.forceRenamed);
}