Ensure we start off with a valid nick
This commit is contained in:
parent
b82a13c467
commit
69dcd4640d
15
ethermess.py
15
ethermess.py
|
@ -552,6 +552,21 @@ def main():
|
||||||
proc = subprocess.Popen([libexec_dir + '/ethermess-backend', interface], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = sys.stderr, bufsize = 0)
|
proc = subprocess.Popen([libexec_dir + '/ethermess-backend', interface], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = sys.stderr, bufsize = 0)
|
||||||
|
|
||||||
# Tell the backend the status and nick
|
# Tell the backend the status and nick
|
||||||
|
try:
|
||||||
|
validate_nick(own_nick)
|
||||||
|
|
||||||
|
except NonCharacterError as err:
|
||||||
|
print('--- Error: contains non-character U+%04X' % ord(err.args[0]))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
except ControlCharacterError as err:
|
||||||
|
print('--- Error: contains control character U+%04X' % ord(err.args[0]))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
except NickLengthError:
|
||||||
|
print('--- Error: nick too long (max. 255B)')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
own_status = statuses.available
|
own_status = statuses.available
|
||||||
encoded = own_nick.encode('utf-8')
|
encoded = own_nick.encode('utf-8')
|
||||||
writeall(proc.stdin, bytes([own_status.value, len(encoded)]) + encoded)
|
writeall(proc.stdin, bytes([own_status.value, len(encoded)]) + encoded)
|
||||||
|
|
Loading…
Reference in New Issue