diff --git a/src/java/com/threerings/crowd/data/BodyObject.java b/src/java/com/threerings/crowd/data/BodyObject.java index 55ce9e282..4561d9d59 100644 --- a/src/java/com/threerings/crowd/data/BodyObject.java +++ b/src/java/com/threerings/crowd/data/BodyObject.java @@ -34,9 +34,6 @@ public class BodyObject extends ClientObject implements SpeakObject { // AUTO-GENERATED: FIELDS START - /** The field name of the username field. */ - public static final String USERNAME = "username"; - /** The field name of the location field. */ public static final String LOCATION = "location"; @@ -47,13 +44,6 @@ public class BodyObject extends ClientObject public static final String AWAY_MESSAGE = "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 Name username; - /** * Identifies the place currently occupied by this body. null if they currently occupy no * place. @@ -94,8 +84,8 @@ public class BodyObject extends ClientObject } /** - * Returns the name that should be displayed to other users. The - * default is to use {@link #username}. + * Returns the name that should be displayed to other users. The default is to use {@link + * #username}. */ public Name getVisibleName () { @@ -103,8 +93,8 @@ public class BodyObject extends ClientObject } /** - * Returns the name that should be used for the chat system. The - * default is to use {@link #username}. + * Returns the name that should be used for the chat system. The default is to use {@link + * #username}. */ public Name getChatName () { @@ -159,22 +149,6 @@ public class BodyObject extends ClientObject } // AUTO-GENERATED: METHODS START - /** - * Requests that the username field be set to the - * specified value. The local value will be updated immediately and an - * event will be propagated through the system to notify all listeners - * that the attribute did change. Proxied copies of this object (on - * clients) will apply the value change when they received the - * attribute changed notification. - */ - public void setUsername (Name value) - { - Name ovalue = this.username; - requestAttributeChange( - USERNAME, value, ovalue); - this.username = value; - } - /** * Requests that the location field be set to the * specified value. The local value will be updated immediately and an diff --git a/src/java/com/threerings/crowd/server/CrowdClientResolver.java b/src/java/com/threerings/crowd/server/CrowdClientResolver.java index 536d22020..ff9e5b05c 100644 --- a/src/java/com/threerings/crowd/server/CrowdClientResolver.java +++ b/src/java/com/threerings/crowd/server/CrowdClientResolver.java @@ -44,14 +44,4 @@ public class CrowdClientResolver extends ClientResolver { return new CrowdPermissionPolicy(); } - - @Override // from ClientResolver - protected void resolveClientData (ClientObject clobj) - throws Exception - { - super.resolveClientData(clobj); - - // just fill in the username - ((BodyObject)clobj).username = _username; - } } diff --git a/src/java/com/threerings/presents/data/ClientObject.java b/src/java/com/threerings/presents/data/ClientObject.java index 7773266d0..e879ac5bf 100644 --- a/src/java/com/threerings/presents/data/ClientObject.java +++ b/src/java/com/threerings/presents/data/ClientObject.java @@ -21,6 +21,8 @@ package com.threerings.presents.data; +import com.threerings.util.Name; + import com.threerings.presents.client.InvocationReceiver; import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.DSet; @@ -32,6 +34,9 @@ import com.threerings.presents.dobj.DSet; public class ClientObject extends DObject { // AUTO-GENERATED: FIELDS START + /** The field name of the username field. */ + public static final String USERNAME = "username"; + /** The field name of the receivers field. */ public static final String RECEIVERS = "receivers"; // AUTO-GENERATED: FIELDS END @@ -40,6 +45,9 @@ public class ClientObject extends DObject * therefore user objects). */ public static final String CLOBJ_CHANGED = "!clobj_changed!"; + /** This client's authentication username. */ + public Name username; + /** Used to publish all invocation service receivers registered on this client. */ public DSet receivers = DSet.newDSet(); @@ -56,7 +64,7 @@ public class ClientObject extends DObject */ public String who () { - return "(" + getOid() + ")"; + return "(" + username + ":" + getOid() + ")"; } /** @@ -123,6 +131,22 @@ public class ClientObject extends DObject } // AUTO-GENERATED: METHODS START + /** + * Requests that the username field be set to the + * specified value. The local value will be updated immediately and an + * event will be propagated through the system to notify all listeners + * that the attribute did change. Proxied copies of this object (on + * clients) will apply the value change when they received the + * attribute changed notification. + */ + public void setUsername (Name value) + { + Name ovalue = this.username; + requestAttributeChange( + USERNAME, value, ovalue); + this.username = value; + } + /** * Requests that the specified entry be added to the * receivers set. The set will not change until the event is diff --git a/src/java/com/threerings/presents/server/ClientResolver.java b/src/java/com/threerings/presents/server/ClientResolver.java index bc8a25fef..5e1bdebc7 100644 --- a/src/java/com/threerings/presents/server/ClientResolver.java +++ b/src/java/com/threerings/presents/server/ClientResolver.java @@ -154,7 +154,8 @@ public class ClientResolver extends Invoker.Unit protected void resolveClientData (ClientObject clobj) throws Exception { - // nothing to do by default + // fill in the username + clobj.username = _username; } /**