Have default be a final constant, pass in message into chat identifier in case they need to check message type or something.
This commit is contained in:
@@ -23,12 +23,16 @@ package com.threerings.crowd.chat.data;
|
|||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
|
import com.threerings.crowd.chat.data.UserMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a mechanism by which the speak service can identify chat listeners so as to maintain a
|
* Provides a mechanism by which the speak service can identify chat listeners so as to maintain a
|
||||||
* recent history of all chat traffic on the server.
|
* recent history of all chat traffic on the server.
|
||||||
*/
|
*/
|
||||||
public interface SpeakObject
|
public interface SpeakObject
|
||||||
{
|
{
|
||||||
|
public static final String DEFAULT_IDENTIFIER = "default";
|
||||||
|
|
||||||
/** Used in conjunction with {@link SpeakObject#applyToListeners}. */
|
/** Used in conjunction with {@link SpeakObject#applyToListeners}. */
|
||||||
public static interface ListenerOp
|
public static interface ListenerOp
|
||||||
{
|
{
|
||||||
@@ -40,9 +44,9 @@ public interface SpeakObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an identifier for what type of chat this speak object represents.
|
* Returns an identifier for what type of chat this speak object represents based on the message.
|
||||||
*/
|
*/
|
||||||
String getChatIdentifier ();
|
String getChatIdentifier (UserMessage message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The speak service will call this every time a chat message is delivered on this speak object
|
* The speak service will call this every time a chat message is delivered on this speak object
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ public class SpeakUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean apply (MessageObserver observer) {
|
public boolean apply (MessageObserver observer) {
|
||||||
observer.messageDelivered(_sender.getChatIdentifier(), _hearer, _message);
|
observer.messageDelivered(_sender.getChatIdentifier(_message), _hearer, _message);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.threerings.presents.data.Permission;
|
|||||||
|
|
||||||
import com.threerings.crowd.chat.data.ChatCodes;
|
import com.threerings.crowd.chat.data.ChatCodes;
|
||||||
import com.threerings.crowd.chat.data.SpeakObject;
|
import com.threerings.crowd.chat.data.SpeakObject;
|
||||||
|
import com.threerings.crowd.chat.data.UserMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The basic user object class for Crowd users. Bodies have a username, a location and a status.
|
* The basic user object class for Crowd users. Bodies have a username, a location and a status.
|
||||||
@@ -131,9 +132,9 @@ public class BodyObject extends ClientObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// from interface SpeakObject
|
// from interface SpeakObject
|
||||||
public String getChatIdentifier ()
|
public String getChatIdentifier (UserMessage message)
|
||||||
{
|
{
|
||||||
return "default";
|
return SpeakObject.DEFAULT_IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.threerings.presents.dobj.ServerMessageEvent;
|
|||||||
import com.threerings.crowd.chat.data.ChatCodes;
|
import com.threerings.crowd.chat.data.ChatCodes;
|
||||||
import com.threerings.crowd.chat.data.SpeakMarshaller;
|
import com.threerings.crowd.chat.data.SpeakMarshaller;
|
||||||
import com.threerings.crowd.chat.data.SpeakObject;
|
import com.threerings.crowd.chat.data.SpeakObject;
|
||||||
|
import com.threerings.crowd.chat.data.UserMessage;
|
||||||
|
|
||||||
import static com.threerings.crowd.Log.log;
|
import static com.threerings.crowd.Log.log;
|
||||||
|
|
||||||
@@ -155,9 +156,9 @@ public class PlaceObject extends DObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public String getChatIdentifier ()
|
public String getChatIdentifier (UserMessage message)
|
||||||
{
|
{
|
||||||
return "default";
|
return SpeakObject.DEFAULT_IDENTIFIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// AUTO-GENERATED: METHODS START
|
// AUTO-GENERATED: METHODS START
|
||||||
|
|||||||
Reference in New Issue
Block a user