From 69a799c412786ebffc2300df8cb1fc4cb997730a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Mon, 15 Jul 2019 20:04:51 +0300 Subject: [PATCH] Add /quit --- ethermess.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ethermess.py b/ethermess.py index e7a53a6..73d8362 100644 --- a/ethermess.py +++ b/ethermess.py @@ -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('--- / ; /msg ; /status ; /available; /unavailable; /nick ; /target ') + print('--- / ; /msg ; /status ; /available; /unavailable; /nick ; /target ; /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