예제 #1
0
        /// <summary>
        /// Broadcasts a message to the <see cref="Chatroom"/>.
        /// </summary>
        public void BroadcastChatMessage(ConnectionCore connection, BroadcastType broadcastType)
        {
            BroadcastMessageComposer comp = new BroadcastMessageComposer(ID, _LastChatMessageId++, connection.ID, connection.ConnectionData.Username, broadcastType);

            foreach (ConnectionCore user in ChatroomUsers.ToArray())
            {
                user.SendMessage(comp);
            }
        }
예제 #2
0
        /// <summary>
        /// Sends a voice message to the <see cref="Chatroom"/> instance.
        /// </summary>
        public void SendMessage(ConnectionCore connection, byte[] message)
        {
            if (!ChatroomUsers.Contains(connection))
            {
                return;
            }

            VoiceMessageComposer composer = new VoiceMessageComposer(ID, _LastChatMessageId++, connection.ID, connection.ConnectionData.Username, message);

            if (ChatroomUsers.Contains(connection))
            {
                foreach (ConnectionCore user in ChatroomUsers.ToArray())
                {
                    user.SendMessage(composer);
                }
            }
        }