protected void dispatchSpeak ( ChatChannel channel , final UserMessage message ) { final ChannelInfo info = _channels . get ( channel ) ; if ( info == null ) { // TODO: maybe we should just reresolve the channel... log . warning ( "Requested to dispatch speak on unhosted channel" , "channel" , channel , "msg" , message ) ; return ; } // validate the speaker if ( ! info . participants . contains ( getBodyId ( message . speaker ) ) ) { log . warning ( "Dropping channel chat message from non-speaker" , "channel" , channel , "message" , message ) ; return ; } // note that we're dispatching a message on this channel info . lastMessage = System . currentTimeMillis ( ) ; // generate a mapping from node name to an array of body ids for the participants that are // currently on the node in question final Map < String , int [ ] > partMap = Maps . newHashMap ( ) ; for ( NodeObject nodeobj : _peerMan . getNodeObjects ( ) ) { ArrayIntSet nodeBodyIds = new ArrayIntSet ( ) ; for ( ClientInfo clinfo : nodeobj . clients ) { int bodyId = getBodyId ( ( ( CrowdClientInfo ) clinfo ) . visibleName ) ; if ( info . participants . contains ( bodyId ) ) { nodeBodyIds . add ( bodyId ) ; } } partMap . put ( nodeobj . nodeName , nodeBodyIds . toIntArray ( ) ) ; } for ( Map . Entry < String , int [ ] > entry : partMap . entrySet ( ) ) { final int [ ] bodyIds = entry . getValue ( ) ; _peerMan . invokeNodeAction ( entry . getKey ( ) , new ChannelAction ( channel ) { @ Override protected void execute ( ) { _channelMan . deliverSpeak ( _channel , message , bodyIds ) ; } } ) ; } }
Requests that we dispatch the supplied message to all participants of the specified chat channel . The speaker will be validated prior to dispatching the message as the originating server does not have the information it needs to validate the speaker and must leave that to us the channel hosting server .