From c4527b252404e9070262d2e1e9e6358bef9678dd Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Fri, 10 Oct 2008 01:25:18 +0000 Subject: [PATCH] Split out the "chat name" from the rest of the visible name usage - Unfortuantely, visible name is used by various game bits as a lookup, so sometimes we want to just override the name to display in chat without affecting those lookups. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5431 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../crowd/chat/server/ChatChannelManager.java | 2 +- .../threerings/crowd/chat/server/ChatProvider.java | 4 ++-- .../threerings/crowd/chat/server/SpeakHandler.java | 2 +- src/java/com/threerings/crowd/data/BodyObject.java | 11 ++++++++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/java/com/threerings/crowd/chat/server/ChatChannelManager.java b/src/java/com/threerings/crowd/chat/server/ChatChannelManager.java index 28861267b..7bb4e6cb0 100644 --- a/src/java/com/threerings/crowd/chat/server/ChatChannelManager.java +++ b/src/java/com/threerings/crowd/chat/server/ChatChannelManager.java @@ -90,7 +90,7 @@ public abstract class ChatChannelManager public void speak (ClientObject caller, final ChatChannel channel, String message, byte mode) { final UserMessage umsg = new UserMessage( - ((BodyObject)caller).getVisibleName(), null, message, mode); + ((BodyObject)caller).getChatName(), null, message, mode); // if we're hosting this channel, dispatch it directly if (_channels.containsKey(channel)) { diff --git a/src/java/com/threerings/crowd/chat/server/ChatProvider.java b/src/java/com/threerings/crowd/chat/server/ChatProvider.java index 93beaf40f..125793bb4 100644 --- a/src/java/com/threerings/crowd/chat/server/ChatProvider.java +++ b/src/java/com/threerings/crowd/chat/server/ChatProvider.java @@ -153,7 +153,7 @@ public class ChatProvider // make sure the requesting user has broadcast privileges InvocationException.requireAccess(caller, ChatCodes.BROADCAST_ACCESS); BodyObject body = (BodyObject)caller; - broadcast(body.getVisibleName(), null, message, false, true); + broadcast(body.getChatName(), null, message, false, true); } /** @@ -254,7 +254,7 @@ public class ChatProvider */ protected UserMessage createTellMessage (BodyObject source, String message) { - return new UserMessage(source.getVisibleName(), message); + return new UserMessage(source.getChatName(), message); } /** diff --git a/src/java/com/threerings/crowd/chat/server/SpeakHandler.java b/src/java/com/threerings/crowd/chat/server/SpeakHandler.java index 245707f80..4b5d3dd25 100644 --- a/src/java/com/threerings/crowd/chat/server/SpeakHandler.java +++ b/src/java/com/threerings/crowd/chat/server/SpeakHandler.java @@ -93,7 +93,7 @@ public class SpeakHandler } else { // issue the speak message on our speak object - SpeakUtil.sendSpeak(_speakObj, source.getVisibleName(), null, message, mode); + SpeakUtil.sendSpeak(_speakObj, source.getChatName(), null, message, mode); } } diff --git a/src/java/com/threerings/crowd/data/BodyObject.java b/src/java/com/threerings/crowd/data/BodyObject.java index 6e41f5a13..55ce9e282 100644 --- a/src/java/com/threerings/crowd/data/BodyObject.java +++ b/src/java/com/threerings/crowd/data/BodyObject.java @@ -94,7 +94,7 @@ public class BodyObject extends ClientObject } /** - * Returns the name that should be displayed to other users and used for the chat system. The + * Returns the name that should be displayed to other users. The * default is to use {@link #username}. */ public Name getVisibleName () @@ -102,6 +102,15 @@ public class BodyObject extends ClientObject return username; } + /** + * Returns the name that should be used for the chat system. The + * default is to use {@link #username}. + */ + public Name getChatName () + { + return getVisibleName(); + } + /** * Creates a blank occupant info instance that will used to publish information about the * various bodies occupying a place.