Maintain user's status in their body object; also maintain a timestamp
that indicates the time at which their status became what it is. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1863 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BodyObject.java,v 1.4 2002/08/14 19:07:49 mdb Exp $
|
||||
// $Id: BodyObject.java,v 1.5 2002/10/30 00:42:37 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.data;
|
||||
|
||||
@@ -13,6 +13,9 @@ public class BodyObject extends ClientObject
|
||||
/** The field name of the <code>location</code> field. */
|
||||
public static final String LOCATION = "location";
|
||||
|
||||
/** The field name of the <code>status</code> field. */
|
||||
public static final String STATUS = "status";
|
||||
|
||||
/**
|
||||
* The username associated with this body object.
|
||||
*/
|
||||
@@ -24,10 +27,26 @@ public class BodyObject extends ClientObject
|
||||
*/
|
||||
public int location = -1;
|
||||
|
||||
/**
|
||||
* The user's current status ({@link OccupantInfo#ACTIVE}, etc.).
|
||||
*/
|
||||
public byte status;
|
||||
|
||||
/**
|
||||
* The time at which the {@link #status} field was last updated. This
|
||||
* is only available on the server.
|
||||
*/
|
||||
public transient long statusTime;
|
||||
|
||||
// documentation inherited
|
||||
public String who ()
|
||||
{
|
||||
return username + " (" + getOid() + ")";
|
||||
StringBuffer buf = new StringBuffer(username);
|
||||
buf.append(" (").append(getOid());
|
||||
if (status != OccupantInfo.ACTIVE) {
|
||||
buf.append(" ").append(OccupantInfo.X_STATUS[status]);
|
||||
}
|
||||
return buf.append(")").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,4 +76,18 @@ public class BodyObject extends ClientObject
|
||||
this.location = location;
|
||||
requestAttributeChange(LOCATION, new Integer(location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>status</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 setStatus (byte status)
|
||||
{
|
||||
this.status = status;
|
||||
requestAttributeChange(STATUS, new Byte(status));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user