diff --git a/src/as/com/threerings/crowd/chat/client/ChatDirector.as b/src/as/com/threerings/crowd/chat/client/ChatDirector.as index 77b01e1b7..632e632ad 100644 --- a/src/as/com/threerings/crowd/chat/client/ChatDirector.as +++ b/src/as/com/threerings/crowd/chat/client/ChatDirector.as @@ -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 { diff --git a/src/as/com/threerings/crowd/chat/data/ChatChannel.as b/src/as/com/threerings/crowd/chat/data/ChatChannel.as index 514d5c070..08e9589c9 100644 --- a/src/as/com/threerings/crowd/chat/data/ChatChannel.as +++ b/src/as/com/threerings/crowd/chat/data/ChatChannel.as @@ -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 { diff --git a/src/as/com/threerings/crowd/chat/data/ChatCodes.as b/src/as/com/threerings/crowd/chat/data/ChatCodes.as index c0b70ae05..c6f7ddb18 100644 --- a/src/as/com/threerings/crowd/chat/data/ChatCodes.as +++ b/src/as/com/threerings/crowd/chat/data/ChatCodes.as @@ -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();