예제 #1
0
        public static TLMessage GetMessage(
            int fromId,
            TLPeerBase toId,
            TLMessageState state,
            bool outFlag,
            bool unreadFlag,
            int date,
            string message,
            TLMessageMediaBase media,
            long randomId,
            int?replyToMsgId)
        {
#if LAYER_40
            var m = new TLMessage
            {
                FromId       = fromId,
                ToId         = toId,
                State        = state,
                IsOut        = outFlag,
                IsUnread     = unreadFlag,
                Date         = date,
                Message      = message,
                Media        = media,
                RandomId     = randomId,
                ReplyToMsgId = replyToMsgId
            };
            if (m.FromId != null)
            {
                m.HasFromId = true;
            }
            if (m.Media != null)
            {
                m.HasMedia = true;
            }
            if (m.ReplyToMsgId != null)
            {
                m.HasReplyToMsgId = true;
            }
#else
            var m = new TLMessage
            {
                FromId       = fromId,
                ToId         = toId,
                _status      = status,
                Out          = outFlag,
                Unread       = unreadFlag,
                _date        = date,
                Message      = message,
                _media       = media,
                RandomId     = randomId,
                ReplyToMsgId = replyToMsgId
            };
#endif

            return(m);
        }
예제 #2
0
        public static TLMessage GetShortMessage(int id, int fromId, TLPeerBase toId, int date, string message)
        {
#if LAYER_40
            var m = new TLMessage
            {
                Id       = id,
                FromId   = fromId,
                ToId     = toId,
                IsOut    = false,
                Date     = date,
                Message  = message,
                Media    = new TLMessageMediaEmpty(),
                IsUnread = true,
            };

            if (m.FromId > 0)
            {
                m.HasFromId = true;
            }
            if (m.Media != null)
            {
                m.HasMedia = true;
            }
#else
            var m = new TLMessage
            {
                Id      = id,
                FromId  = fromId,
                ToId    = toId,
                Out     = false,
                _date   = date,
                Message = message,
                _media  = new TLMessageMediaEmpty()
            };
#endif
            return(m);
        }