List all known peers if /status called without a target
This commit is contained in:
parent
a140fde1c1
commit
90c435cfd9
1 changed files with 11 additions and 5 deletions
|
@ -178,12 +178,18 @@ def handle_user_command(backend, line):
|
||||||
|
|
||||||
elif command == '/status':
|
elif command == '/status':
|
||||||
# Request status
|
# Request status
|
||||||
|
if rest != '':
|
||||||
mac = mac_from_name(rest)
|
mac = mac_from_name(rest)
|
||||||
if mac in peers:
|
if mac in peers:
|
||||||
print('=== ~%s (%s) [%s]' % (peers[mac].nick, peers[mac].status.name, format_mac(mac)))
|
print('=== ~%s (%s) [%s]' % (peers[mac].nick, peers[mac].status.name, format_mac(mac)))
|
||||||
else:
|
else:
|
||||||
send_status_request(backend, mac)
|
send_status_request(backend, mac)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# 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 == '':
|
elif command == '/available' and rest == '':
|
||||||
# Set status to available
|
# Set status to available
|
||||||
own_status = statuses.available
|
own_status = statuses.available
|
||||||
|
@ -210,7 +216,7 @@ def handle_user_command(backend, line):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Display usage
|
# 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:
|
except NoMatchesError as err:
|
||||||
print('--- name %s matches no peers' % err.args[0])
|
print('--- name %s matches no peers' % err.args[0])
|
||||||
|
|
Loading…
Reference in a new issue