Chat revamp, phase 1.

- Repackaged crowd/chat
- All messages are delivered to the client via ChatMessage messages,
  including tells.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2631 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2003-06-03 21:41:33 +00:00
parent 368cd940b6
commit 40afe3cb94
33 changed files with 218 additions and 416 deletions
@@ -1,7 +1,7 @@
//
// $Id: ChatCodes.java,v 1.15 2003/03/30 02:53:05 mdb Exp $
// $Id: ChatCodes.java,v 1.16 2003/06/03 21:41:33 ray Exp $
package com.threerings.crowd.chat;
package com.threerings.crowd.chat.data;
import com.threerings.presents.data.InvocationCodes;
@@ -10,6 +10,9 @@ import com.threerings.presents.data.InvocationCodes;
*/
public interface ChatCodes extends InvocationCodes
{
/** The message identifier for a chat notification message. */
public static final String CHAT_NOTIFICATION = "chat";
/** The chat localtype code for chat messages delivered on the place
* object currently occupied by the client. This is the only type of
* chat message that will be delivered unless the chat director is
@@ -17,14 +20,8 @@ public interface ChatCodes extends InvocationCodes
* ChatDirector#addAuxiliarySource}. */
public static final String PLACE_CHAT_TYPE = "placeChat";
/** The message identifier for a speak notification message. */
public static final String SPEAK_NOTIFICATION = "spknot";
/** The message identifier for a system notification message. */
public static final String SYSTEM_NOTIFICATION = "sysnot";
/** The chat localtype for tells. */
public static final String TELL_CHAT_TYPE = "tellChat";
/** The chat localtype for messages received on the user object. */
public static final String USER_CHAT_TYPE = "userChat";
/** The default mode used by {@link SpeakService#speak} requests. */
public static final byte DEFAULT_MODE = 0;
@@ -1,10 +1,10 @@
//
// $Id: ChatMarshaller.java,v 1.4 2002/10/31 23:27:16 mdb Exp $
// $Id: ChatMarshaller.java,v 1.5 2003/06/03 21:41:33 ray Exp $
package com.threerings.crowd.chat;
package com.threerings.crowd.chat.data;
import com.threerings.crowd.chat.ChatService;
import com.threerings.crowd.chat.ChatService.TellListener;
import com.threerings.crowd.chat.client.ChatService;
import com.threerings.crowd.chat.client.ChatService.TellListener;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService.InvocationListener;
import com.threerings.presents.data.InvocationMarshaller;
@@ -94,5 +94,4 @@ public class ChatMarshaller extends InvocationMarshaller
});
}
// Generated on 13:40:31 10/31/02.
}
@@ -1,32 +1,56 @@
//
// $Id: ChatMessage.java,v 1.3 2003/03/30 02:52:53 mdb Exp $
// $Id: ChatMessage.java,v 1.4 2003/06/03 21:41:33 ray Exp $
package com.threerings.crowd.chat;
package com.threerings.crowd.chat.data;
import com.samskivert.util.StringUtil;
import com.threerings.io.Streamable;
/**
* The abstract base class of all the client-side ChatMessage objects.
*/
public abstract class ChatMessage
implements Streamable
{
/** The actual text of the message. */
public String message;
/** The localtype of this chat, set to the type registered with an
* auxiliary source in the ChatDirector. */
public String localtype;
/** The bundle to use when translating this message. */
public String bundle;
/** The time that this message was created on the client. */
public long timestamp;
/** The client side 'localtype' of this chat, set to the type
* registered with an auxiliary source in the ChatDirector. */
public transient String localtype;
/** The client time that this message was created. */
public transient long timestamp;
/**
* For all your unserialization needs.
*/
public ChatMessage ()
{
}
/**
* Construct a ChatMessage.
*/
public ChatMessage (String message, String localtype)
public ChatMessage (String message, String bundle)
{
this.message = message;
this.bundle = bundle;
}
/**
* Once this message reaches the client, the information contained within
* is changed around a bit.
*/
public void setClientInfo (String msg, String localtype)
{
message = msg;
this.localtype = localtype;
bundle = null;
timestamp = System.currentTimeMillis();
}
@@ -1,7 +1,7 @@
//
// $Id: FeedbackMessage.java,v 1.1 2002/07/26 20:35:01 ray Exp $
// $Id: FeedbackMessage.java,v 1.2 2003/06/03 21:41:33 ray Exp $
package com.threerings.crowd.chat;
package com.threerings.crowd.chat.data;
/**
* A ChatMessage to indicate to the user that an action they took
@@ -9,6 +9,10 @@ package com.threerings.crowd.chat;
*/
public class FeedbackMessage extends ChatMessage
{
public FeedbackMessage ()
{
}
/**
* Construct a FeedbackMessage.
*/
@@ -1,9 +1,9 @@
//
// $Id: SpeakMarshaller.java,v 1.2 2002/08/20 19:38:13 mdb Exp $
// $Id: SpeakMarshaller.java,v 1.3 2003/06/03 21:41:33 ray Exp $
package com.threerings.crowd.chat;
package com.threerings.crowd.chat.data;
import com.threerings.crowd.chat.SpeakService;
import com.threerings.crowd.chat.client.SpeakService;
import com.threerings.presents.client.Client;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.dobj.InvocationResponseEvent;
@@ -14,10 +14,6 @@ import com.threerings.presents.dobj.InvocationResponseEvent;
* on the server. Also provides an implementation of the response listener
* interfaces that marshall the response arguments and deliver them back
* to the requesting client.
*
* <p> Generated from <code>
* $Id: SpeakMarshaller.java,v 1.2 2002/08/20 19:38:13 mdb Exp $
* </code>
*/
public class SpeakMarshaller extends InvocationMarshaller
implements SpeakService
@@ -33,5 +29,4 @@ public class SpeakMarshaller extends InvocationMarshaller
});
}
// Class file generated on 12:33:01 08/20/02.
}
@@ -1,7 +1,7 @@
//
// $Id: SystemMessage.java,v 1.1 2002/07/26 20:35:01 ray Exp $
// $Id: SystemMessage.java,v 1.2 2003/06/03 21:41:33 ray Exp $
package com.threerings.crowd.chat;
package com.threerings.crowd.chat.data;
/**
* A ChatMessage that represents a message that came from the server
@@ -9,11 +9,15 @@ package com.threerings.crowd.chat;
*/
public class SystemMessage extends ChatMessage
{
public SystemMessage ()
{
}
/**
* Construct a SystemMessage.
*/
public SystemMessage (String message, String localtype)
public SystemMessage (String message, String bundle)
{
super(message, localtype);
super(message, bundle);
}
}
@@ -1,7 +1,7 @@
//
// $Id: UserMessage.java,v 1.1 2002/07/26 20:35:01 ray Exp $
// $Id: UserMessage.java,v 1.2 2003/06/03 21:41:33 ray Exp $
package com.threerings.crowd.chat;
package com.threerings.crowd.chat.data;
/**
* A ChatMessage representing a message that came from another user.
@@ -14,13 +14,20 @@ public class UserMessage extends ChatMessage
/** The mode of the message. @see ChatCodes.DEFAULT_MODE */
public byte mode;
/**
* For unserialization.
*/
public UserMessage ()
{
}
/**
* Construct a user message.
*/
public UserMessage (String message, String localtype,
public UserMessage (String message, String bundle,
String speaker, byte mode)
{
super(message, localtype);
super(message, bundle);
this.speaker = speaker;
this.mode = mode;
}