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:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ChatProvider.java,v 1.9 2002/02/26 05:47:40 mdb Exp $
|
||||
// $Id: ChatProvider.java,v 1.10 2002/04/30 17:27:30 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.chat;
|
||||
|
||||
@@ -33,27 +33,63 @@ public class ChatProvider
|
||||
|
||||
} else {
|
||||
// deliver a tell notification to the target player
|
||||
Object[] args = new Object[] { source.username, message };
|
||||
CrowdServer.invmgr.sendNotification(
|
||||
tobj.getOid(), MODULE_NAME, TELL_NOTIFICATION, args);
|
||||
sendTellMessage(tobj.getOid(), source.username, null, message);
|
||||
// let the teller know it went ok
|
||||
sendResponse(source, invid, TELL_SUCCEEDED_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delivers a tell notification to the specified target player,
|
||||
* originating with the specified speaker.
|
||||
*
|
||||
* @param targetOid the body object id of the user that will receive
|
||||
* the tell message.
|
||||
* @param speaker the username of the user that generated the message
|
||||
* (or some special speaker name for server messages).
|
||||
* @param bundle the bundle identifier that will be used by the client
|
||||
* to translate the message text (this would be null in all cases
|
||||
* except where the message originated from some server entity that
|
||||
* was "faking" a tell to a real player).
|
||||
* @param message the text of the chat message.
|
||||
*/
|
||||
public static void sendTellMessage (
|
||||
int targetOid, String speaker, String bundle, String message)
|
||||
{
|
||||
Object[] args = null;
|
||||
if (bundle == null) {
|
||||
args = new Object[] { speaker, message };
|
||||
} else {
|
||||
args = new Object[] { speaker, bundle, message };
|
||||
}
|
||||
CrowdServer.invmgr.sendNotification(
|
||||
targetOid, MODULE_NAME, TELL_NOTIFICATION, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a chat notification to the specified place object originating
|
||||
* with the specified speaker and with the supplied message content.
|
||||
* with the specified speaker (the speaker optionally being a server
|
||||
* entity that wishes to fake a "speak" message) and with the supplied
|
||||
* message content.
|
||||
*
|
||||
* @param placeOid the place to which to deliver the chat message.
|
||||
* @param speaker the username of the user that generated the message
|
||||
* (or some special speaker name for server messages).
|
||||
* @param bundle null when the message originates from a real human,
|
||||
* the bundle identifier that will be used by the client to translate
|
||||
* the message text when the message originates from a server entity
|
||||
* "faking" a chat message.
|
||||
* @param message the text of the chat message.
|
||||
*/
|
||||
public static void sendChatMessage (
|
||||
int placeOid, String speaker, String message)
|
||||
int placeOid, String speaker, String bundle, String message)
|
||||
{
|
||||
Object[] outargs = new Object[] { speaker, message };
|
||||
Object[] outargs = null;
|
||||
if (bundle == null) {
|
||||
outargs = new Object[] { speaker, message };
|
||||
} else {
|
||||
outargs = new Object[] { speaker, bundle, message };
|
||||
}
|
||||
MessageEvent nevt = new MessageEvent(
|
||||
placeOid, ChatService.SPEAK_NOTIFICATION, outargs);
|
||||
CrowdServer.omgr.postEvent(nevt);
|
||||
|
||||
Reference in New Issue
Block a user