List all known peers if /status called without a target
This commit is contained in:
parent
a140fde1c1
commit
90c435cfd9
16
ethermess.py
16
ethermess.py
|
@ -178,11 +178,17 @@ def handle_user_command(backend, line):
|
|||
|
||||
elif command == '/status':
|
||||
# Request status
|
||||
mac = mac_from_name(rest)
|
||||
if mac in peers:
|
||||
print('=== ~%s (%s) [%s]' % (peers[mac].nick, peers[mac].status.name, format_mac(mac)))
|
||||
if rest != '':
|
||||
mac = mac_from_name(rest)
|
||||
if mac in peers:
|
||||
print('=== ~%s (%s) [%s]' % (peers[mac].nick, peers[mac].status.name, format_mac(mac)))
|
||||
else:
|
||||
send_status_request(backend, mac)
|
||||
|
||||
else:
|
||||
send_status_request(backend, mac)
|
||||
# List all the known peers
|
||||
for mac, peer in peers.items():
|
||||
print('=== ~%s (%s) [%s]' % (peer.nick, peer.status.name, format_mac(mac)))
|
||||
|
||||
elif command == '/available' and rest == '':
|
||||
# Set status to available
|
||||
|
@ -210,7 +216,7 @@ def handle_user_command(backend, line):
|
|||
|
||||
else:
|
||||
# Display usage
|
||||
print('--- / <message>; /msg <target> <message>; /status <target>; /available; /unavailable; /nick <nick>; /target <target>; /quit')
|
||||
print('--- / <message>; /msg <target> <message>; /status [<target>]; /available; /unavailable; /nick <nick>; /target <target>; /quit')
|
||||
|
||||
except NoMatchesError as err:
|
||||
print('--- name %s matches no peers' % err.args[0])
|
||||
|
|
Loading…
Reference in New Issue