Update a user's status in their occupant info via the place manager as
required, rather than directly in the place object. Don't need dobjmgr in constructor. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1881 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
//
|
//
|
||||||
// $Id: BodyProvider.java,v 1.1 2002/11/01 00:39:18 shaper Exp $
|
// $Id: BodyProvider.java,v 1.2 2002/11/01 21:33:21 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.crowd.server;
|
package com.threerings.crowd.server;
|
||||||
|
|
||||||
import com.threerings.presents.dobj.DObjectManager;
|
|
||||||
|
|
||||||
import com.threerings.presents.data.ClientObject;
|
import com.threerings.presents.data.ClientObject;
|
||||||
import com.threerings.presents.server.InvocationException;
|
import com.threerings.presents.server.InvocationException;
|
||||||
import com.threerings.presents.server.InvocationManager;
|
import com.threerings.presents.server.InvocationManager;
|
||||||
@@ -25,10 +23,8 @@ public class BodyProvider
|
|||||||
* Constructs and initializes a body provider instance which will be
|
* Constructs and initializes a body provider instance which will be
|
||||||
* used to handle all body-related invocation service requests.
|
* used to handle all body-related invocation service requests.
|
||||||
*/
|
*/
|
||||||
public static void init (InvocationManager invmgr, DObjectManager omgr)
|
public static void init (InvocationManager invmgr)
|
||||||
{
|
{
|
||||||
_omgr = omgr;
|
|
||||||
|
|
||||||
// register a provider instance
|
// register a provider instance
|
||||||
invmgr.registerDispatcher(new BodyDispatcher(new BodyProvider()), true);
|
invmgr.registerDispatcher(new BodyDispatcher(new BodyProvider()), true);
|
||||||
}
|
}
|
||||||
@@ -52,7 +48,7 @@ public class BodyProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update their status!
|
// update their status!
|
||||||
Log.info("setIdle [user=" + bobj.username +
|
Log.info("Setting user idle state [user=" + bobj.username +
|
||||||
", status=" + nstatus + "].");
|
", status=" + nstatus + "].");
|
||||||
updateOccupantStatus(bobj, bobj.location, nstatus);
|
updateOccupantStatus(bobj, bobj.location, nstatus);
|
||||||
}
|
}
|
||||||
@@ -73,10 +69,15 @@ public class BodyProvider
|
|||||||
body.setStatus(status);
|
body.setStatus(status);
|
||||||
body.statusTime = System.currentTimeMillis();
|
body.statusTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
// get the place manager for the specified location
|
||||||
|
PlaceManager pmgr = CrowdServer.plreg.getPlaceManager(locationId);
|
||||||
|
if (pmgr == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get the place object for the specified location (which is, in
|
// get the place object for the specified location (which is, in
|
||||||
// theory, occupied by this user)
|
// theory, occupied by this user)
|
||||||
PlaceObject plobj = (PlaceObject)
|
PlaceObject plobj = pmgr.getPlaceObject();
|
||||||
CrowdServer.omgr.getObject(locationId);
|
|
||||||
if (plobj == null) {
|
if (plobj == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -86,10 +87,7 @@ public class BodyProvider
|
|||||||
plobj.occupantInfo.get(new Integer(body.getOid()));
|
plobj.occupantInfo.get(new Integer(body.getOid()));
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
info.status = status;
|
info.status = status;
|
||||||
plobj.updateOccupantInfo(info);
|
pmgr.updateOccupantInfo(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The distributed object manager used by the chat services. */
|
|
||||||
protected static DObjectManager _omgr;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user