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
This commit is contained in:
Mike Thomas
2008-10-10 01:25:18 +00:00
parent 19ac92f624
commit c4527b2524
4 changed files with 14 additions and 5 deletions
@@ -90,7 +90,7 @@ public abstract class ChatChannelManager
public void speak (ClientObject caller, final ChatChannel channel, String message, byte mode) public void speak (ClientObject caller, final ChatChannel channel, String message, byte mode)
{ {
final UserMessage umsg = new UserMessage( 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 we're hosting this channel, dispatch it directly
if (_channels.containsKey(channel)) { if (_channels.containsKey(channel)) {
@@ -153,7 +153,7 @@ public class ChatProvider
// make sure the requesting user has broadcast privileges // make sure the requesting user has broadcast privileges
InvocationException.requireAccess(caller, ChatCodes.BROADCAST_ACCESS); InvocationException.requireAccess(caller, ChatCodes.BROADCAST_ACCESS);
BodyObject body = (BodyObject)caller; 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) protected UserMessage createTellMessage (BodyObject source, String message)
{ {
return new UserMessage(source.getVisibleName(), message); return new UserMessage(source.getChatName(), message);
} }
/** /**
@@ -93,7 +93,7 @@ public class SpeakHandler
} else { } else {
// issue the speak message on our speak object // issue the speak message on our speak object
SpeakUtil.sendSpeak(_speakObj, source.getVisibleName(), null, message, mode); SpeakUtil.sendSpeak(_speakObj, source.getChatName(), null, message, mode);
} }
} }
@@ -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}. * default is to use {@link #username}.
*/ */
public Name getVisibleName () public Name getVisibleName ()
@@ -102,6 +102,15 @@ public class BodyObject extends ClientObject
return username; 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 * Creates a blank occupant info instance that will used to publish information about the
* various bodies occupying a place. * various bodies occupying a place.