Conditionally allow ASCII characters (for Xaekai)
This commit is contained in:
parent
7002874bbb
commit
91c24518c5
4 changed files with 30 additions and 17 deletions
|
|
@ -116,8 +116,14 @@ ChatModule.prototype.handleChatMsg = function (user, data) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Limit to 240 characters, disallow all ASCII control characters except tab (\t)
|
||||
data.msg = data.msg.substring(0, 240).replace(/[\x00-\x08\x0a-\x1f]+/g, " ");
|
||||
// Limit to 240 characters
|
||||
data.msg = data.msg.substring(0, 240);
|
||||
// If channel doesn't permit them, strip ASCII control characters
|
||||
if (!this.channel.modules.options ||
|
||||
!this.channel.modules.options.get("allow_ascii_control")) {
|
||||
|
||||
data.msg = data.msg.replace(/[\x00-\x1f]+/g, " ");
|
||||
}
|
||||
|
||||
// Disallow blankposting
|
||||
if (!data.msg.trim()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue