Stopped people from using Unicode format characters to pretend to be the server.

This commit is contained in:
Cerapter 2018-08-30 13:32:09 +02:00
parent 85ceb708f7
commit c3e29d6850

View File

@ -26,6 +26,7 @@ from .exceptions import ClientError, AreaError, ArgumentError, ServerError
from .fantacrypt import fanta_decrypt
from .evidence import EvidenceList
from .websocket import WebSocket
import unicodedata
class AOProtocol(asyncio.Protocol):
@ -440,6 +441,10 @@ class AOProtocol(asyncio.Protocol):
if len(self.client.name) > 30:
self.client.send_host_message('Your OOC name is too long! Limit it to 30 characters.')
return
for c in self.client.name:
if unicodedata.category(c) == 'Cf':
self.client.send_host_message('You cannot use format characters in your name!')
return
if self.client.name.startswith(self.server.config['hostname']) or self.client.name.startswith('<dollar>G'):
self.client.send_host_message('That name is reserved!')
return