Localized chat! Server entities may now fake speak and tell messages that

are translated by the client upon receipt. We love to translate.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1319 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-04-30 17:27:30 +00:00
parent 530a348890
commit 4ec673e6c2
7 changed files with 159 additions and 38 deletions
@@ -1,5 +1,5 @@
//
// $Id: ChatDirector.java,v 1.19 2002/02/26 20:52:45 mdb Exp $
// $Id: ChatDirector.java,v 1.20 2002/04/30 17:27:30 mdb Exp $
package com.threerings.crowd.chat;
@@ -215,7 +215,24 @@ public class ChatDirector
// pass this on to our chat displays
for (int i = 0; i < _displays.size(); i++) {
ChatDisplay display = (ChatDisplay)_displays.get(i);
display.displayTellMessage(source, message);
display.displayTellMessage(source, null, message);
}
}
/**
* Called by the invocation director when an entity on the server has
* requested that we deliver a tell notification to this
* client. Because the server generated the notification, displays
* will want to translate the message itself using the supplied bundle
* identifier.
*/
public void handleTellNotification (
String source, String bundle, String message)
{
// pass this on to our chat displays
for (int i = 0; i < _displays.size(); i++) {
ChatDisplay display = (ChatDisplay)_displays.get(i);
display.displayTellMessage(source, bundle, message);
}
}
@@ -260,12 +277,22 @@ public class ChatDirector
protected void handleSpeakMessage (String type, Object[] args)
{
String speaker = (String)args[0];
String message = (String)args[1];
String bundle = null;
String message = null;
// determine whether this speak message originated from another
// client or from a server entity
if (args.length == 2) {
message = (String)args[1];
} else {
bundle = (String)args[1];
message = (String)args[2];
}
// pass this on to our chat displays
for (int i = 0; i < _displays.size(); i++) {
ChatDisplay display = (ChatDisplay)_displays.get(i);
display.displaySpeakMessage(type, speaker, message);
display.displaySpeakMessage(type, speaker, bundle, message);
}
}
@@ -1,5 +1,5 @@
//
// $Id: ChatDisplay.java,v 1.8 2002/02/26 05:47:40 mdb Exp $
// $Id: ChatDisplay.java,v 1.9 2002/04/30 17:27:30 mdb Exp $
package com.threerings.crowd.chat;
@@ -22,10 +22,14 @@ public interface ChatDisplay
* auxiliary chat object, the type code provided when that auxiliary
* object was registered.
* @param speaker the username of the speaker.
* @param bundle for speak messages that originated with a server
* entity rather than another client, this will be non-null and will
* contain a bundle identifier that should be used to translate the
* message text.
* @param message the text of the message.
*/
public void displaySpeakMessage (
String type, String speaker, String message);
String type, String speaker, String bundle, String message);
/**
* Called to display a tell message. A tell message is one that is
@@ -33,9 +37,14 @@ public interface ChatDisplay
* location in the system.
*
* @param speaker the username of the speaker.
* @param bundle for tell messages that originated with a server
* entity rather than another client, this will be non-null and will
* contain a bundle identifier that should be used to translate the
* message text.
* @param message the text of the message.
*/
public void displayTellMessage (String speaker, String message);
public void displayTellMessage (
String speaker, String bundle, String message);
/**
* Called to display a system message. A system message is one that is