mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 15:07:16 +02:00
Alphabetize imclist output.
This commit is contained in:
parent
d8f6074f10
commit
a8434e3c97
2 changed files with 18 additions and 5 deletions
|
|
@ -56,8 +56,9 @@ def cmd_imclist(command):
|
|||
source_object = command.source_object
|
||||
|
||||
retval = 'Active MUDs on %s\n\r' % imc2_conn.IMC2_PROTOCOL_INSTANCE.network_name
|
||||
for name, mudinfo in IMC2_MUDLIST.mud_list.items():
|
||||
mudline = ' %-20s %s' % (name, mudinfo.versionid)
|
||||
|
||||
for mudinfo in IMC2_MUDLIST.get_mud_list():
|
||||
mudline = ' %-20s %s' % (mudinfo.name, mudinfo.versionid)
|
||||
retval += '%s\n\r' % mudline[:78]
|
||||
retval += '%s active MUDs found.' % len(IMC2_MUDLIST.mud_list)
|
||||
source_object.emit_to(retval)
|
||||
|
|
|
|||
|
|
@ -29,14 +29,26 @@ class IMC2MudList(object):
|
|||
# Mud list is stored in a dict, key being the IMC Mud name.
|
||||
self.mud_list = {}
|
||||
|
||||
def get_mud_list(self):
|
||||
"""
|
||||
Returns a sorted list of connected Muds.
|
||||
"""
|
||||
muds = self.mud_list.items()
|
||||
muds.sort()
|
||||
return [value for key, value in muds]
|
||||
|
||||
def update_mud_from_packet(self, packet):
|
||||
# This grabs relevant info from the packet and stuffs it in the
|
||||
# Mud list for later retrieval.
|
||||
"""
|
||||
This grabs relevant info from the packet and stuffs it in the
|
||||
Mud list for later retrieval.
|
||||
"""
|
||||
mud = IMC2Mud(packet)
|
||||
self.mud_list[mud.name] = mud
|
||||
|
||||
def remove_mud_from_packet(self, packet):
|
||||
# Removes a mud from the Mud list when given a packet.
|
||||
"""
|
||||
Removes a mud from the Mud list when given a packet.
|
||||
"""
|
||||
mud = IMC2Mud(packet)
|
||||
try:
|
||||
del self.mud_list[mud.name]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue