A few chat channel related fixes.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5382 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-09-17 23:08:48 +00:00
parent f139ec53f4
commit 278306bb1f
3 changed files with 24 additions and 5 deletions
@@ -50,6 +50,7 @@ import com.threerings.crowd.data.CrowdCodes;
import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.util.CrowdContext;
import com.threerings.crowd.chat.data.ChatChannel;
import com.threerings.crowd.chat.data.ChatCodes;
import com.threerings.crowd.chat.data.ChatMarshaller;
import com.threerings.crowd.chat.data.ChatMessage;
@@ -595,9 +596,12 @@ public class ChatDirector extends BasicDirector
public function messageReceived (event :MessageEvent) :void
{
if (ChatCodes.CHAT_NOTIFICATION === event.getName()) {
var msg :ChatMessage = (event.getArgs()[0] as ChatMessage);
var localtype :String = getLocalType(event.getTargetOid());
processReceivedMessage(msg, localtype);
processReceivedMessage(event.getArgs()[0] as ChatMessage,
getLocalType(event.getTargetOid()));
} else if (ChatCodes.CHAT_CHANNEL_NOTIFICATION === event.getName()) {
processReceivedMessage(event.getArgs()[1] as ChatMessage,
getChannelLocalType(event.getArgs()[0] as ChatChannel));
}
}
@@ -970,6 +974,14 @@ public class ChatDirector extends BasicDirector
return (typ == null) ? ChatCodes.PLACE_CHAT_TYPE : typ;
}
/**
* Returns the local type for a chat channel message.
*/
protected function getChannelLocalType (channel :ChatChannel) :String
{
throw new Error("Users of the chat channel system must implement getChannelLocalType()");
}
// from BasicDirector
override protected function registerServices (client :Client) :void
{
@@ -24,6 +24,7 @@ package com.threerings.crowd.chat.data {
import com.threerings.io.SimpleStreamableObject;
import com.threerings.util.Comparable;
import com.threerings.util.Equalable;
import com.threerings.util.Hashable;
import com.threerings.presents.dobj.DSet_Entry;
@@ -31,7 +32,7 @@ import com.threerings.presents.dobj.DSet_Entry;
* Represents a chat channel.
*/
public /*abstract*/ class ChatChannel extends SimpleStreamableObject
implements Comparable, Equalable, DSet_Entry
implements Comparable, Hashable, Equalable, DSet_Entry
{
// from interface Comparable
public function compareTo (other :Object) :int
@@ -39,6 +40,12 @@ public /*abstract*/ class ChatChannel extends SimpleStreamableObject
throw new Error("abstract");
}
// from interface Hashable
public function hashCode () :int
{
throw new Error("abstract");
}
// from interface Equalable
public function equals (other :Object) :Boolean
{
@@ -39,7 +39,7 @@ public class ChatCodes extends InvocationCodes
public static const CHAT_NOTIFICATION :String = "crowd.chat";
/** The message identifier for a chat channel notification message. */
public static const CHAT_CHANENL_NOTIFICATION :String = "crowd.chat.channel";
public static const CHAT_CHANNEL_NOTIFICATION :String = "crowd.chat.channel";
/** The access control identifier for normal chat privileges. */
public static const CHAT_ACCESS :Permission = new Permission();