From e1f4c2e0da600b2af29f537d6a12e42da15465f2 Mon Sep 17 00:00:00 2001 From: Greg Taylor Date: Tue, 15 May 2007 14:30:52 +0000 Subject: [PATCH] @cdestroy now implemented as per MUX. --- cmdtable.py | 1 + commands_comsys.py | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/cmdtable.py b/cmdtable.py index ca23c6c20e..0428006861 100644 --- a/cmdtable.py +++ b/cmdtable.py @@ -28,6 +28,7 @@ ctable = { "version": commands_general.cmd_version, "who": commands_general.cmd_who, "@ccreate": commands_comsys.cmd_ccreate, + "@cdestroy": commands_comsys.cmd_cdestroy, "@clist": commands_comsys.cmd_clist, "@create": commands_privileged.cmd_create, "@description": commands_privileged.cmd_description, diff --git a/commands_comsys.py b/commands_comsys.py index 2dc0e113ec..e6f880df3f 100644 --- a/commands_comsys.py +++ b/commands_comsys.py @@ -55,9 +55,11 @@ def cmd_clist(cdat): Lists all available channels on the game. """ session = cdat['session'] - session.msg("*** Channel Owner Description") + session.msg("** Channel Owner Description") for chan in functions_comsys.get_all_channels(): - session.msg("--- %s %s" % (chan.get_name(), chan.get_owner().get_name())) + session.msg("%s%s %-13.13s %-15.15s %-45.45s" % + ('-', '-', chan.get_name(), chan.get_owner().get_name(), 'No Description')) + session.msg("-- End of Channel List --") def cmd_cdestroy(cdat): """ @@ -65,7 +67,23 @@ def cmd_cdestroy(cdat): Destroys a channel. """ - pass + session = cdat['session'] + pobject = session.get_pobject() + uinput= cdat['uinput']['splitted'] + cname = ' '.join(uinput[1:]) + + if cname == '': + session.msg("You must supply a name!") + return + + name_matches = functions_comsys.cname_search(cname, exact=True) + + if not name_matches: + session.msg("Could not find channel %s." % (cname,)) + else: + session.msg("Channel %s destroyed." % (name_matches[0],)) + name_matches.delete() + def cmd_cset(cdat): """