From 7e7f164c710c2dcfe3d98da58f65d6124e1b1ea0 Mon Sep 17 00:00:00 2001 From: Michael King Date: Thu, 9 Aug 2007 13:12:49 +0000 Subject: [PATCH] Moved @boot to a more sensible place. --- cmdtable.py | 2 +- commands/objmanip.py | 65 ------------------------------------------ commands/privileged.py | 65 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/cmdtable.py b/cmdtable.py index a38bb13494..c4c827c892 100644 --- a/cmdtable.py +++ b/cmdtable.py @@ -48,7 +48,7 @@ ctable = { "version": (commands.general.cmd_version, None), "who": (commands.general.cmd_who, None), "@alias": (commands.objmanip.cmd_alias, None), - "@boot": (commands.objmanip.cmd_boot, ("genperms.manage_players")), + "@boot": (commands.privileged.cmd_boot, ("genperms.manage_players")), "@ccreate": (commands.comsys.cmd_ccreate, ("objects.add_commchannel")), "@cdestroy": (commands.comsys.cmd_cdestroy, ("objects.delete_commchannel")), "@cemit": (commands.comsys.cmd_cemit, None), diff --git a/commands/objmanip.py b/commands/objmanip.py index 66460f2409..5042ebddc3 100644 --- a/commands/objmanip.py +++ b/commands/objmanip.py @@ -545,68 +545,3 @@ def cmd_destroy(cdat): session.msg("You destroy %s." % (target_obj.get_name(),)) target_obj.destroy() - -def cmd_boot(cdat): - """ - Boot a player object from the server. - """ - session = cdat['session'] - pobject = session.get_pobject() - args = cdat['uinput']['splitted'][1:] - eq_args = ' '.join(args).split('=') - searchstring = ''.join(eq_args[0]) - switches = cdat['uinput']['root_chunk'][1:] - switch_quiet = False - switch_port = False - - if not pobject.is_staff(): - session.msg("You do not have permission to do that.") - return - - if "quiet" in switches: - switch_quiet = True - - if "port" in switches: - switch_port = True - - if len(args) == 0: - session.msg("Who would you like to boot?") - return - else: - boot_list = [] - if switch_port: - sessions = session_mgr.get_session_list(True) - for sess in sessions: - if sess.getClientAddress()[1] == int(searchstring): - boot_list.append(sess) - # We're done here - break - else: - # Grab the objects that match - objs = functions_db.global_object_name_search(searchstring) - - if len(objs) < 1: - session.msg("Who would you like to boot?") - return - - if not objs[0].is_player(): - session.msg("You can only boot players.") - return - - if not pobject.controls_other(objs[0]): - if objs[0].is_superuser(): - session.msg("You cannot boot a Wizard.") - return - else: - session.msg("You do not have permission to boot that player.") - return - - if objs[0].is_connected_plr(): - boot_list.append(session_mgr.session_from_object(objs[0])) - - for boot in boot_list: - if not switch_quiet: - boot.msg("You have been disconnected by %s." % (pobject.name)) - boot.disconnectClient() - session_mgr.remove_session(boot) - return diff --git a/commands/privileged.py b/commands/privileged.py index 9759baf067..6137b7db88 100644 --- a/commands/privileged.py +++ b/commands/privileged.py @@ -15,6 +15,71 @@ def cmd_reload(cdat): session = cdat['session'] server = session.server.reload(session) +def cmd_boot(cdat): + """ + Boot a player object from the server. + """ + session = cdat['session'] + pobject = session.get_pobject() + args = cdat['uinput']['splitted'][1:] + eq_args = ' '.join(args).split('=') + searchstring = ''.join(eq_args[0]) + switches = cdat['uinput']['root_chunk'][1:] + switch_quiet = False + switch_port = False + + if not pobject.is_staff(): + session.msg("You do not have permission to do that.") + return + + if "quiet" in switches: + switch_quiet = True + + if "port" in switches: + switch_port = True + + if len(args) == 0: + session.msg("Who would you like to boot?") + return + else: + boot_list = [] + if switch_port: + sessions = session_mgr.get_session_list(True) + for sess in sessions: + if sess.getClientAddress()[1] == int(searchstring): + boot_list.append(sess) + # We're done here + break + else: + # Grab the objects that match + objs = functions_db.global_object_name_search(searchstring) + + if len(objs) < 1: + session.msg("Who would you like to boot?") + return + + if not objs[0].is_player(): + session.msg("You can only boot players.") + return + + if not pobject.controls_other(objs[0]): + if objs[0].is_superuser(): + session.msg("You cannot boot a Wizard.") + return + else: + session.msg("You do not have permission to boot that player.") + return + + if objs[0].is_connected_plr(): + boot_list.append(session_mgr.session_from_object(objs[0])) + + for boot in boot_list: + if not switch_quiet: + boot.msg("You have been disconnected by %s." % (pobject.name)) + boot.disconnectClient() + session_mgr.remove_session(boot) + return + def cmd_newpassword(cdat): """ Set a player's password.