Have messages know their own formatting string.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4496 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -67,6 +67,14 @@ public /*abstract*/ class ChatMessage
|
||||
timestamp = getTimer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the appropriate message format for this message.
|
||||
*/
|
||||
public function getFormat () :String
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this instance.
|
||||
*/
|
||||
|
||||
@@ -36,5 +36,10 @@ public class TellFeedbackMessage extends UserMessage
|
||||
super(target, null, message);
|
||||
setClientInfo(message, ChatCodes.PLACE_CHAT_TYPE);
|
||||
}
|
||||
|
||||
override public function getFormat () :String
|
||||
{
|
||||
return "m.told_format";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,21 @@ public class UserMessage extends ChatMessage
|
||||
return speaker;
|
||||
}
|
||||
|
||||
override public function getFormat () :String
|
||||
{
|
||||
switch (mode) {
|
||||
case ChatCodes.THINK_MODE: return "m.think_format";
|
||||
case ChatCodes.EMOTE_MODE: return "m.emote_format";
|
||||
case ChatCodes.SHOUT_MODE: return "m.shout_format";
|
||||
case ChatCodes.BROADCAST_MODE: return "m.broadcast_format";
|
||||
}
|
||||
|
||||
if (ChatCodes.USER_CHAT_TYPE === localtype) {
|
||||
return "m.tell_format";
|
||||
}
|
||||
return "m.speak_format";
|
||||
}
|
||||
|
||||
// from interface Streamable
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
|
||||
@@ -72,6 +72,14 @@ public abstract class ChatMessage
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the appropriate message format for this message.
|
||||
*/
|
||||
public String getFormat ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a string representation of this instance.
|
||||
*/
|
||||
|
||||
@@ -36,4 +36,10 @@ public class TellFeedbackMessage extends UserMessage
|
||||
super(target, null, message, ChatCodes.DEFAULT_MODE);
|
||||
setClientInfo(message, ChatCodes.PLACE_CHAT_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormat ()
|
||||
{
|
||||
return "m.told_format";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,4 +71,20 @@ public class UserMessage extends ChatMessage
|
||||
{
|
||||
return speaker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormat ()
|
||||
{
|
||||
switch (mode) {
|
||||
case ChatCodes.THINK_MODE: return "m.think_format";
|
||||
case ChatCodes.EMOTE_MODE: return "m.emote_format";
|
||||
case ChatCodes.SHOUT_MODE: return "m.shout_format";
|
||||
case ChatCodes.BROADCAST_MODE: return "m.broadcast_format";
|
||||
}
|
||||
|
||||
if (ChatCodes.USER_CHAT_TYPE.equals(localtype)) {
|
||||
return "m.tell_format";
|
||||
}
|
||||
return "m.speak_format";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user