Added facilities for sending system messages to places which are like

speak messages but come from the server and are displayed differently
(like in all red or something because these will say things like "The
system is shutting down in five minutes.")


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@501 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-10-18 23:55:24 +00:00
parent a78728edcb
commit 094c1f1ce6
4 changed files with 48 additions and 4 deletions
@@ -1,5 +1,5 @@
//
// $Id: ChatDirector.java,v 1.11 2001/10/12 00:03:02 mdb Exp $
// $Id: ChatDirector.java,v 1.12 2001/10/18 23:55:24 mdb Exp $
package com.threerings.crowd.chat;
@@ -143,6 +143,8 @@ public class ChatDirector
String name = event.getName();
if (name.equals(ChatService.SPEAK_NOTIFICATION)) {
handleSpeakMessage(event.getArgs());
} else if (name.equals(ChatService.SYSTEM_NOTIFICATION)) {
handleSystemMessage(event.getArgs());
}
}
@@ -200,6 +202,17 @@ public class ChatDirector
}
}
protected void handleSystemMessage (Object[] args)
{
String message = (String)args[0];
// pass this on to our chat displays
for (int i = 0; i < _displays.size(); i++) {
ChatDisplay display = (ChatDisplay)_displays.get(i);
display.displaySystemMessage(message);
}
}
protected CrowdContext _ctx;
protected PlaceObject _place;
protected ArrayList _displays = new ArrayList();
@@ -1,5 +1,5 @@
//
// $Id: ChatDisplay.java,v 1.3 2001/10/11 04:07:51 mdb Exp $
// $Id: ChatDisplay.java,v 1.4 2001/10/18 23:55:24 mdb Exp $
package com.threerings.crowd.chat;
@@ -32,6 +32,17 @@ public interface ChatDisplay
*/
public void displayTellMessage (String speaker, String message);
/**
* Called to display a system message. A system message is one that is
* broadcast to all occupants of a particular place and rather than
* originating from some other user in the place, originates from the
* server and should be displayed visually differently from speak
* messages.
*
* @param message the text of the message.
*/
public void displaySystemMessage (String message);
/**
* Called in response to a chat request (either speak or tell) that
* originated on this client. The request id supplied will match the