private RTMMessage BuildRTMMessage(Quest quest, long from, long to, long mid)
        {
            RTMMessage rtmMessage = new RTMMessage
            {
                fromUid      = from,
                toId         = to,
                messageId    = mid,
                messageType  = quest.Want <byte>("mtype"),
                attrs        = quest.Want <string>("attrs"),
                modifiedTime = quest.Want <long>("mtime")
            };

            if (rtmMessage.messageType == (byte)MessageType.Chat)
            {
                rtmMessage.translatedInfo = ProcessChatMessage(quest);
                if (rtmMessage.translatedInfo != null)
                {
                    if (rtmMessage.translatedInfo.targetText.Length > 0)
                    {
                        rtmMessage.stringMessage = rtmMessage.translatedInfo.targetText;
                    }
                    else
                    {
                        rtmMessage.stringMessage = rtmMessage.translatedInfo.sourceText;
                    }
                }
            }
            else if (rtmMessage.messageType == (byte)MessageType.Cmd)
            {
                rtmMessage.stringMessage = quest.Want <string>("msg");
            }
            else if (rtmMessage.messageType >= 40 && rtmMessage.messageType <= 50)
            {
                rtmMessage.stringMessage = quest.Want <string>("msg");
                RTMClient.BuildFileInfo(rtmMessage, errorRecorder);
            }
            else
            {
                MessageInfo messageInfo = BuildMessageInfo(quest);
                if (messageInfo.isBinary)
                {
                    rtmMessage.binaryMessage = messageInfo.binaryData;
                }
                else
                {
                    rtmMessage.stringMessage = messageInfo.message;
                }
            }

            return(rtmMessage);
        }
        public Answer PushRoomMessage(Int64 connectionId, string endpoint, Quest quest)
        {
            AdvanceAnswer.SendAnswer(new Answer(quest));

            if (questProcessor == null)
            {
                return(null);
            }

            long from   = quest.Want <long>("from");
            long roomId = quest.Want <long>("rid");
            long mid    = quest.Want <long>("mid");

            if (duplicatedFilter.CheckRoomMessage(roomId, from, mid) == false)
            {
                return(null);
            }

            RTMMessage rtmMessage = BuildRTMMessage(quest, from, roomId, mid);

            if (rtmMessage.messageType == (byte)MessageType.Chat)
            {
                if (rtmMessage.translatedInfo != null)
                {
                    questProcessor.PushRoomChat(rtmMessage);
                }
            }
            else if (rtmMessage.messageType == (byte)MessageType.Cmd)
            {
                questProcessor.PushRoomCmd(rtmMessage);
            }
            else if (rtmMessage.messageType >= 40 && rtmMessage.messageType <= 50)
            {
                questProcessor.PushRoomFile(rtmMessage);
            }
            else
            {
                questProcessor.PushRoomMessage(rtmMessage);
            }

            return(null);
        }
 public virtual void PushBroadcastFile(RTMMessage message)
 {
 }
 public virtual void PushRoomFile(RTMMessage message)
 {
 }
 public virtual void PushGroupFile(RTMMessage message)
 {
 }
 public virtual void PushBroadcastCmd(RTMMessage message)
 {
 }
 public virtual void PushRoomCmd(RTMMessage message)
 {
 }
 public virtual void PushGroupCmd(RTMMessage message)
 {
 }
 //-- Chat
 public virtual void PushChat(RTMMessage message)
 {
 }
 //----------------[ Message Interfaces ]-----------------//
 //-- Messages
 public virtual void PushMessage(RTMMessage message)
 {
 }