From a99238faf85d64df2544eaf65326810266d14d70 Mon Sep 17 00:00:00 2001 From: Jamie Doornbos Date: Sat, 11 Oct 2008 05:17:40 +0000 Subject: [PATCH] Fixed username member for actionscript. Serialization was completely hosed git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5437 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/crowd/data/BodyObject.as | 19 ++++--------------- .../threerings/presents/data/ClientObject.as | 8 +++++++- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/as/com/threerings/crowd/data/BodyObject.as b/src/as/com/threerings/crowd/data/BodyObject.as index 33bb76c08..b3b5da7ba 100644 --- a/src/as/com/threerings/crowd/data/BodyObject.as +++ b/src/as/com/threerings/crowd/data/BodyObject.as @@ -33,14 +33,11 @@ import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; /** - * The basic user object class for Crowd users. Bodies have a username, a location and a status. + * The basic user object class for Crowd users. Bodies have a location and a status. */ public class BodyObject extends ClientObject { // AUTO-GENERATED: FIELDS START - /** The field name of the username field. */ - public static const USERNAME :String = "username"; - /** The field name of the location field. */ public static const LOCATION :String = "location"; @@ -51,13 +48,6 @@ public class BodyObject extends ClientObject public static const AWAY_MESSAGE :String = "awayMessage"; // AUTO-GENERATED: FIELDS END - /** - * The username associated with this body object. This should not be used directly; in general - * {@link #getVisibleName} should be used unless you specifically know that you want the - * username. - */ - public var username :Name; - /** * The oid of the place currently occupied by this body or -1 if they currently occupy no * place. @@ -84,8 +74,9 @@ public class BodyObject extends ClientObject } /** - * Returns the name that should be displayed to other users and used for - * the chat system. The default is to use {@link #username}. + * Returns the name that should be displayed to other users. The default is to use + * username. + * @see com.threerings.presents.data.ClientObject#username */ public function getVisibleName () :Name { @@ -189,8 +180,6 @@ public class BodyObject extends ClientObject override public function readObject (ins :ObjectInputStream) :void { super.readObject(ins); - - username = (ins.readObject() as Name); location = (ins.readObject() as Place); status = ins.readByte(); awayMessage = (ins.readField(String) as String); diff --git a/src/as/com/threerings/presents/data/ClientObject.as b/src/as/com/threerings/presents/data/ClientObject.as index ba9e058a2..a6bec3c61 100644 --- a/src/as/com/threerings/presents/data/ClientObject.as +++ b/src/as/com/threerings/presents/data/ClientObject.as @@ -21,6 +21,8 @@ package com.threerings.presents.data { +import com.threerings.util.Name; + import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.DSet; import com.threerings.presents.dobj.DSet_Entry; @@ -45,6 +47,9 @@ public class ClientObject extends DObject * switch usernames (and therefore user objects). */ public static const CLOBJ_CHANGED :String = "!clobj_changed!"; + /** The authenticated user name of this client. */ + public var username :Name; + /** Used to publish all invocation service receivers registered on * this client. */ public var receivers :DSet; @@ -54,7 +59,7 @@ public class ClientObject extends DObject */ public function who () :String { - return "(" + getOid() + ")"; + return "(" + username + ":" + getOid() + ")"; } /** @@ -103,6 +108,7 @@ public class ClientObject extends DObject override public function readObject (ins :ObjectInputStream) :void { super.readObject(ins); + username = (ins.readObject() as Name); receivers = (ins.readObject() as DSet); _permPolicy = (ins.readObject() as PermissionPolicy); }