Make the spot cluster chat stuff operate on UserMessages instead of creating

one at the 11th hour so we can pass in our own fancier UserMessage subclasses
as appropriate.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@552 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Dave Hoover
2008-01-29 19:09:30 +00:00
parent 8dd26afb4b
commit d622907abb
2 changed files with 42 additions and 24 deletions
@@ -25,19 +25,15 @@ import java.util.HashMap;
import java.util.Iterator;
import com.samskivert.util.HashIntMap;
import com.threerings.util.Name;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.Subscriber;
import com.threerings.presents.dobj.ObjectAccessException;
import com.threerings.presents.server.InvocationException;
import com.threerings.crowd.chat.data.UserMessage;
import com.threerings.crowd.chat.server.SpeakUtil;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.OccupantInfo;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.server.InvocationException;
import com.threerings.util.Name;
import com.threerings.whirled.server.SceneManager;
import com.threerings.whirled.spot.Log;
import com.threerings.whirled.spot.data.Cluster;
import com.threerings.whirled.spot.data.ClusterObject;
@@ -389,15 +385,25 @@ public class SpotSceneManager extends SceneManager
/**
* Called by the {@link SpotProvider} when we receive a cluster speak request.
*/
@Deprecated
protected void handleClusterSpeakRequest (int sourceOid, Name source, String bundle,
String message, byte mode)
{
handleClusterMessageRequest(sourceOid, new UserMessage(source, bundle, message, mode));
}
/**
* Called by the {@link SpotProvider} when we receive a cluster message request.
*/
protected void handleClusterMessageRequest (int sourceOid, UserMessage message)
{
ClusterRecord clrec = getCluster(sourceOid);
if (clrec == null) {
Log.warning("Non-clustered user requested cluster speak [where=" + where() +
", chatter=" + source + " (" + sourceOid + "), msg=" + message + "].");
", chatter=" + message.speaker + " (" + sourceOid + "), " +
"msg=" + message + "].");
} else {
SpeakUtil.sendSpeak(clrec.getClusterObject(), source, bundle, message, mode);
SpeakUtil.sendMessage(clrec.getClusterObject(), message);
}
}