Add /quit

This commit is contained in:
Juhani Krekelä 2019-07-15 20:04:51 +03:00
parent 8e7339e3f1
commit 69a799c412
1 changed files with 7 additions and 2 deletions

View File

@ -162,9 +162,12 @@ def handle_user_command(backend, line):
elif command == '/target':
default_target_mac = parse_mac(rest)
elif command == '/quit':
return 'quit'
else:
# Display usage
print('--- / <message>; /msg <MAC> <message>; /status <MAC>; /available; /unavailable; /nick <nick>; /target <MAC>')
print('--- / <message>; /msg <MAC> <message>; /status <MAC>; /available; /unavailable; /nick <nick>; /target <MAC>; /quit')
else:
# Send message
@ -369,7 +372,9 @@ def eventloop(proc):
break
line, _, input_buffer = input_buffer.partition(b'\n')
handle_user_command(proc.stdin, line.decode('utf-8'))
if handle_user_command(proc.stdin, line.decode('utf-8')) == 'quit':
writeall(proc.stdin, b'q')
running = False
if data == b'':
# ^D