From 19a87635189ffc24c3b5e31278a9e4756103e63a Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Mon, 29 Nov 2010 21:25:40 +0000 Subject: [PATCH] Leave some backwards compatibility leniency in here, since it appears there's code out there that instantiates SpeakHandlers. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6309 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/chat/server/SpeakHandler.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/threerings/crowd/chat/server/SpeakHandler.java b/src/main/java/com/threerings/crowd/chat/server/SpeakHandler.java index 154c3432a..5c4b33b0c 100644 --- a/src/main/java/com/threerings/crowd/chat/server/SpeakHandler.java +++ b/src/main/java/com/threerings/crowd/chat/server/SpeakHandler.java @@ -63,6 +63,19 @@ public class SpeakHandler * @param validator an optional validator that can be used to prevent arbitrary users from * using the speech services on this object. */ + public SpeakHandler (DObject speakObj, SpeakerValidator validator) + { + this(null, speakObj, validator); + } + + /** + * Creates a handler that will provide speech on the supplied distributed object. + * + * @param locator the object we use to look up BodyObjects from ClientObjects + * @param speakObj the object for which speech requests will be processed. + * @param validator an optional validator that can be used to prevent arbitrary users from + * using the speech services on this object. + */ public SpeakHandler (BodyLocator locator, DObject speakObj, SpeakerValidator validator) { _locator = locator; @@ -74,7 +87,9 @@ public class SpeakHandler public void speak (ClientObject caller, String message, byte mode) { // ensure that the caller has normal chat privileges - BodyObject source = _locator.forClient(caller); + BodyObject source = (_locator != null) ? _locator.forClient(caller) : + (BodyObject) caller; + String errmsg = caller.checkAccess(ChatCodes.CHAT_ACCESS, null); if (errmsg != null) { // we normally don't listen for responses to speak messages so we can't just throw an