Moved BodyObject.username down to ClientObject.username so that one can look up

the PresentsClient given a ClientObject.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5435 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-10-10 22:45:58 +00:00
parent 91d7846b46
commit 97b6ea79c5
4 changed files with 31 additions and 42 deletions
@@ -34,9 +34,6 @@ public class BodyObject extends ClientObject
implements SpeakObject
{
// AUTO-GENERATED: FIELDS START
/** The field name of the <code>username</code> field. */
public static final String USERNAME = "username";
/** The field name of the <code>location</code> 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 <code>username</code> 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 <code>location</code> field be set to the
* specified value. The local value will be updated immediately and an
@@ -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;
}
}
@@ -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 <code>username</code> field. */
public static final String USERNAME = "username";
/** The field name of the <code>receivers</code> 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<InvocationReceiver.Registration> 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 <code>username</code> 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
* <code>receivers</code> set. The set will not change until the event is
@@ -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;
}
/**