* After review of the codebase some more, discovered better methods for most of what I was trying to do.

* Before this change, it was no longer dumping the connection, but was always claiming that the target player was not online, when they were.
* Back to the drawing board on cmd_page for now.
This commit is contained in:
Michael King 2007-04-28 14:26:28 +00:00
parent 3054d1233f
commit 21a03fc07c

View file

@ -241,18 +241,26 @@ def cmd_page(cdat):
""" """
Send a message to target user (if online). Send a message to target user (if online).
""" """
from apps.objects.models import Object
session = cdat['session'] session = cdat['session']
target_name = cdat['uinput']['splitted'][1:][0] # discard command name
message = cdat['uinput']['splitted'][1:][1:] cdat['uinput']['splitted'].pop(0)
target_name = cdat['uinput']['splitted'].pop(0)
message = ' '.join(cdat['uinput']['splitted'])
target = Object.objects.get(name__iexact=target_name) target = Object.objects.get(name__iexact=target_name)
try: if target:
if target.is_connected_plr(): session.msg("Found user %s.", (target.get_name(),))
target.emit_to("% pages you with: %s" % (session.something, message)) try:
session.get_pobject().emit_to("Page sent.") if target.is_connected_plr():
else: target.emit_to("% pages you with: %s" %
session.get_pobject().emit_to("User %s is not logged on." % (target_name.capitalize(),)) (session.get_pobject().name.capitalize(), message))
except: session.msg("Page sent.")
session.get_pobject().emit_to("User %s not found." % (target_name,)) else:
session.msg("User %s is not logged on." % (target_name.capitalize(),))
except:
pass
else:
session.msg("User %s not found." % (target_name,))
def cmd_quit(cdat): def cmd_quit(cdat):
""" """