Added @boot.

Currently, @boot will boot the first username match it comes across, if connected.

It will not boot non-player objects, and it will not allow staff to boot other staff.
This commit is contained in:
Michael King 2007-08-07 19:19:31 +00:00
parent 3fe64c1f34
commit 684ae521b7
3 changed files with 67 additions and 1 deletions

View file

@ -452,7 +452,7 @@ class Object(models.Model):
functions_general.log_errmsg("Missing default home, %s '%s(#%d)' now has a null location." % (text, obj.name, obj.id))
if obj.is_player():
if obj.is_connected():
if obj.is_connected_plr():
if home:
obj.emit_to("Your current location has ceased to exist, moving you to your home %s(#%d)." % (home.name, home.id))
else:

View file

@ -48,6 +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")),
"@ccreate": (commands.comsys.cmd_ccreate, ("objects.add_commchannel")),
"@cdestroy": (commands.comsys.cmd_cdestroy, ("objects.delete_commchannel")),
"@cemit": (commands.comsys.cmd_cemit, None),

View file

@ -545,3 +545,68 @@ 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