Make /status and /nick display your own if run with no arguments, and move listing of all peers to /peers
This commit is contained in:
parent
6abb09b0c9
commit
6c3820c42f
34
ethermess.py
34
ethermess.py
|
@ -230,17 +230,21 @@ def handle_user_command(backend, line):
|
||||||
queue_message(backend, mac, message)
|
queue_message(backend, mac, message)
|
||||||
|
|
||||||
elif command == '/status':
|
elif command == '/status':
|
||||||
# Request status
|
|
||||||
if rest != '':
|
if rest != '':
|
||||||
|
# Request status
|
||||||
mac = mac_from_name(rest)
|
mac = mac_from_name(rest)
|
||||||
if mac in peers:
|
if mac in peers:
|
||||||
print('%s === ~%s (%s) [%s]' % (timestamp(), peers[mac].nick, peers[mac].status.name, format_mac(mac)))
|
print('%s === ~%s (%s) [%s]' % (timestamp(), peers[mac].nick, peers[mac].status.name, format_mac(mac)))
|
||||||
send_status_request(backend, mac)
|
send_status_request(backend, mac)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# List all the known peers
|
# Show own
|
||||||
for mac, peer in peers.items():
|
print('--- %s' % own_status.name)
|
||||||
print('%s === ~%s (%s) [%s]' % (timestamp(), peer.nick, peer.status.name, format_mac(mac)))
|
|
||||||
|
elif command == '/peers' and rest == '':
|
||||||
|
# List all the known peers
|
||||||
|
for mac, peer in peers.items():
|
||||||
|
print('--- ~%s (%s) [%s]' % (timestamp(), 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
|
||||||
|
@ -253,11 +257,23 @@ def handle_user_command(backend, line):
|
||||||
set_status_nick(backend, own_status, own_nick)
|
set_status_nick(backend, own_status, own_nick)
|
||||||
|
|
||||||
elif command == '/nick':
|
elif command == '/nick':
|
||||||
# Change nick
|
if rest != '':
|
||||||
validate_nick(rest)
|
# Change nick
|
||||||
|
if rest[0] == '~':
|
||||||
|
# Remove the ~ from the front if it is there
|
||||||
|
nick = rest[1:]
|
||||||
|
else:
|
||||||
|
nick = rest
|
||||||
|
|
||||||
own_nick = rest
|
validate_nick(nick)
|
||||||
set_status_nick(backend, own_status, own_nick)
|
|
||||||
|
own_nick = nick
|
||||||
|
|
||||||
|
set_status_nick(backend, own_status, own_nick)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Show own
|
||||||
|
print('--- ~%s' % own_nick)
|
||||||
|
|
||||||
elif command == '/target':
|
elif command == '/target':
|
||||||
# Set default target of messages
|
# Set default target of messages
|
||||||
|
@ -269,7 +285,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>]; /peers; /available; /unavailable; /nick [<nick>]; /target <target>; /quit')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Send message
|
# Send message
|
||||||
|
|
Loading…
Reference in New Issue