2019-07-10 19:10:14 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
libexec_dir = __LIBEXECDIR__
|
2019-07-10 19:44:20 +00:00
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
|
|
|
|
nick = input('nick> ').encode('utf-8')
|
|
|
|
|
|
|
|
proc = subprocess.Popen(['sudo', libexec_dir + '/ethermess-backend', *sys.argv[1:]], stdin = subprocess.PIPE, stdout = sys.stdout)
|
|
|
|
|
|
|
|
proc.stdin.write(bytes([0, len(nick)]) + nick)
|
|
|
|
proc.stdin.flush()
|
|
|
|
|
|
|
|
print('s - request status, i - request msgid, m - send message, ^D - quit')
|
|
|
|
|
|
|
|
try:
|
|
|
|
while True:
|
|
|
|
proc.stdin.write(input('').encode('utf-8'))
|
|
|
|
proc.stdin.flush()
|
|
|
|
|
|
|
|
except EOFError:
|
|
|
|
proc.stdin.write(b'q')
|
|
|
|
proc.stdin.flush()
|
|
|
|
|
|
|
|
sys.exit(proc.wait())
|