Beispiel #1
0
        public override TLChatBase ToChat(TLChatBase chat)
        {
            chat.NotifySettings = NotifySettings;
            chat.Participants   = Participants;
            chat.ChatPhoto      = ChatPhoto;

            var channel = chat as TLChannel;

            if (channel != null)
            {
                channel.About              = About;
                channel.ParticipantsCount  = ParticipantsCount;
                channel.AdminsCount        = AdminsCount;
                channel.KickedCount        = KickedCount;
                channel.ReadInboxMaxId     = ReadInboxMaxId;
                channel.ExportedInvite     = ExportedInvite;
                channel.BotInfo            = BotInfo;
                channel.MigratedFromChatId = MigratedFromChatId;
                channel.MigratedFromMaxId  = MigratedFromMaxId;
            }

            var channel49 = chat as TLChannel49;

            if (channel49 != null)
            {
                channel49.ReadOutboxMaxId = ReadOutboxMaxId;
                channel49.PinnedMsgId     = PinnedMsgId;
            }

            return(chat);
        }
Beispiel #2
0
        public override void Update(TLChatBase chatBase)
        {
            base.Update(chatBase);

            var channel = chatBase as TLChannel;

            if (channel != null)
            {
                if (channel.IsMin)
                {
                    // TODO: ???
                    return;
                }

                this.Flags             = channel.Flags;
                this.Id                = channel.Id;
                this.AccessHash        = channel.AccessHash;
                this.Title             = channel.Title;
                this.Username          = channel.Username;
                this.Photo             = channel.Photo;
                this.Date              = channel.Date;
                this.Version           = channel.Version;
                this.RestrictionReason = channel.RestrictionReason;


                if (channel.ReadInboxMaxId != 0 && (ReadInboxMaxId == 0 || ReadInboxMaxId < channel.ReadInboxMaxId))
                {
                    ReadInboxMaxId = channel.ReadInboxMaxId;
                }
                if (channel.ReadOutboxMaxId != 0 && (ReadOutboxMaxId == 0 || ReadOutboxMaxId < channel.ReadOutboxMaxId))
                {
                    ReadOutboxMaxId = channel.ReadOutboxMaxId;
                }
            }
        }
Beispiel #3
0
        public override TLObject FromBytes(byte[] bytes, ref int position)
        {
            bytes.ThrowExceptionIfIncorrect(ref position, Signature);

            Chat = GetObject <TLChatBase>(bytes, ref position);

            return(this);
        }
Beispiel #4
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = (TLChatForbidden)chat;

            Title = c.Title;
            Date  = c.Date;
        }
Beispiel #5
0
        public virtual TLChatBase ToChat(TLChatBase chat)
        {
            chat.NotifySettings = NotifySettings;
            chat.Participants   = Participants;
            chat.ChatPhoto      = ChatPhoto;

            return(chat);
        }
        public override TLChatBase ToChat(TLChatBase chat)
        {
            if (chat is TLChannel channel)
            {
                channel.ReadInboxMaxId  = this.ReadInboxMaxId;
                channel.ReadOutboxMaxId = this.ReadOutboxMaxId;
            }

            return(base.ToChat(chat));
        }
Beispiel #7
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLChatForbidden40;

            if (c != null)
            {
                if (c.CustomFlags != null)
                {
                    CustomFlags = c.CustomFlags;
                }
            }
        }
Beispiel #8
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLChat41;

            if (c != null)
            {
                if (c.MigratedTo != null)
                {
                    MigratedTo = c.MigratedTo;
                }
            }
        }
Beispiel #9
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLChannel;

            if (c != null)
            {
                if (c.Flags != null)
                {
                    Flags = c.Flags;
                }

                if (c.CustomFlags != null)
                {
                    CustomFlags = c.CustomFlags;
                }

                if (c.ParticipantIds != null)
                {
                    ParticipantIds = c.ParticipantIds;
                }
                if (c.About != null)
                {
                    About = c.About;
                }
                if (c.ParticipantsCount != null)
                {
                    ParticipantsCount = c.ParticipantsCount;
                }
                if (c.AdminsCount != null)
                {
                    AdminsCount = c.AdminsCount;
                }
                if (c.KickedCount != null)
                {
                    KickedCount = c.KickedCount;
                }
                if (c.ReadInboxMaxId != null)
                {
                    ReadInboxMaxId = c.ReadInboxMaxId;
                }
                if (c.Participants != null)
                {
                    Participants = c.Participants;
                }
                if (c.NotifySettings != null)
                {
                    NotifySettings = c.NotifySettings;
                }
            }
        }
Beispiel #10
0
        public override void Update(TLChatBase chatBase)
        {
            base.Update(chatBase);

            var chat = chatBase as TLChat;

            if (chat != null)
            {
                // TODO: check if dirty?

                this.Flags             = chat.Flags;
                this.Title             = chat.Title;
                this.Photo             = chat.Photo;
                this.ParticipantsCount = chat.ParticipantsCount;
                this.Date       = chat.Date;
                this.Version    = chat.Version;
                this.MigratedTo = chat.MigratedTo;


                //Title = chat.Title;
                //if (Photo.GetType() != chat.Photo.GetType())
                //{
                //    Photo = chat.Photo;    // при удалении фото чата не обновляется UI при _photo = c.Photo
                //}
                //else
                //{
                //    Photo.Update(chat.Photo);
                //}
                //ParticipantsCount = chat.ParticipantsCount;
                //Date = chat.Date;
                //IsLeft = chat.IsLeft;
                //Version = chat.Version;

                //Flags = chat.Flags;

                if (chat.ReadInboxMaxId != 0 && (ReadInboxMaxId == 0 || ReadInboxMaxId < chat.ReadInboxMaxId))
                {
                    ReadInboxMaxId = chat.ReadInboxMaxId;
                }
                if (chat.ReadOutboxMaxId != 0 && (ReadOutboxMaxId == 0 || ReadOutboxMaxId < chat.ReadOutboxMaxId))
                {
                    ReadOutboxMaxId = chat.ReadOutboxMaxId;
                }

                ////if (c.CustomFlags != null)
                ////{
                ////    CustomFlags = c.CustomFlags;
                ////}
            }
        }
Beispiel #11
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLChannelForbidden;

            if (c != null)
            {
                Id         = c.Id;
                AccessHash = c.AccessHash;
                Title      = c.Title;

                if (c.CustomFlags != null)
                {
                    CustomFlags = c.CustomFlags;
                }
            }
        }
        public override void Update(TLChatBase chatBase)
        {
            base.Update(chatBase);

            var channel = chatBase as TLChannel;

            if (channel != null)
            {
                if (channel.ReadInboxMaxId != 0 && (ReadInboxMaxId == 0 || ReadInboxMaxId < channel.ReadInboxMaxId))
                {
                    ReadInboxMaxId = channel.ReadInboxMaxId;
                }
                if (channel.ReadOutboxMaxId != 0 && (ReadOutboxMaxId == 0 || ReadOutboxMaxId < channel.ReadOutboxMaxId))
                {
                    ReadOutboxMaxId = channel.ReadOutboxMaxId;
                }
            }
        }
Beispiel #13
0
        public override TLChatBase ToChat(TLChatBase chat)
        {
            chat.NotifySettings = NotifySettings;
            chat.Participants   = Participants;
            chat.ChatPhoto      = ChatPhoto;

            var channel = chat as TLChannel;

            if (channel != null)
            {
                channel.Full = true;

                channel.About              = About;
                channel.ParticipantsCount  = ParticipantsCount;
                channel.AdminsCount        = AdminsCount;
                channel.KickedCount        = KickedCount;
                channel.ReadInboxMaxId     = ReadInboxMaxId;
                channel.ExportedInvite     = ExportedInvite;
                channel.BotInfo            = BotInfo;
                channel.MigratedFromChatId = MigratedFromChatId;
                channel.MigratedFromMaxId  = MigratedFromMaxId;
            }

            var channel49 = chat as TLChannel49;

            if (channel49 != null)
            {
                channel49.ReadOutboxMaxId = ReadOutboxMaxId;
                channel49.PinnedMsgId     = PinnedMsgId;
            }

            var channel68 = chat as TLChannel68;

            if (channel68 != null)
            {
                channel68.CanSetStickers = CanSetStickers;
                channel68.StickerSet     = StickerSet ?? new TLStickerSetEmpty();

                channel68.HiddenPrehistory = HiddenPrehistory;
                channel68.AvailableMinId   = AvailableMinId;
            }

            return(chat);
        }
        //#region Full chat information

        //public TLChatParticipantsBase Participants { get; set; }

        //public TLPhotoBase ChatPhoto { get; set; }

        //public TLPeerNotifySettingsBase NotifySettings { get; set; }

        //public int UsersOnline { get; set; }

        //public TLExportedChatInviteBase ExportedInvite { get; set; }

        //public TLVector<TLBotInfo> BotInfo { get; set; }

        //#endregion

        public virtual void Update(TLChatBase chat)
        {
            Id = chat.Id;

            //if (chat.Participants != null)
            //{
            //    Participants = chat.Participants;
            //}

            //if (chat.ChatPhoto != null)
            //{
            //    ChatPhoto = chat.ChatPhoto;
            //}

            //if (chat.NotifySettings != null)
            //{
            //    NotifySettings = chat.NotifySettings;
            //}
        }
Beispiel #15
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLBroadcastChat;

            if (c != null)
            {
                _title = c.Title;
                if (Photo.GetType() != c.Photo.GetType())
                {
                    _photo = c.Photo;
                }
                else
                {
                    Photo.Update(c.Photo);
                }
                ParticipantIds = c.ParticipantIds;
            }
        }
Beispiel #16
0
        public virtual void Update(TLChatBase chat)
        {
            Id = chat.Id;

            if (chat.Participants != null)
            {
                Participants = chat.Participants;
            }

            if (chat.ChatPhoto != null)
            {
                ChatPhoto = chat.ChatPhoto;
            }

            if (chat.NotifySettings != null)
            {
                NotifySettings = chat.NotifySettings;
            }
        }
        //public TLChatBase ToChat(TLChatBase chat)
        //{
        //    //chat.NotifySettings = NotifySettings;
        //    //chat.Participants = Participants;
        //    //chat.ChatPhoto = ChatPhoto;

        //    //var channel = chat as TLChannel;
        //    //if (channel != null)
        //    //{
        //    //    channel.ExportedInvite = ExportedInvite;
        //    //    channel.About = About;
        //    //    channel.ParticipantsCount = ParticipantsCount;
        //    //    channel.AdminsCount = AdminsCount;
        //    //    channel.KickedCount = KickedCount;
        //    //    channel.ReadInboxMaxId = ReadInboxMaxId;
        //    //}

        //    return chat;
        //}

        public virtual TLChatBase ToChat(TLChatBase chat)
        {
            //chat.NotifySettings = NotifySettings;
            //chat.Participants = Participants;
            //chat.ChatPhoto = ChatPhoto;

            //var channel = chat as TLChannel;
            //if (channel != null)
            //{
            //    channel.ExportedInvite = ExportedInvite;
            //    channel.About = About;
            //    channel.ParticipantsCount = ParticipantsCount;
            //    channel.AdminsCount = AdminsCount;
            //    channel.KickedCount = KickedCount;
            //    channel.ReadInboxMaxId = ReadInboxMaxId;
            //}

            return(chat);
        }
Beispiel #18
0
        public override TLChatBase ToChat(TLChatBase chat)
        {
            chat.NotifySettings = NotifySettings;
            chat.Participants   = Participants;
            chat.ChatPhoto      = ChatPhoto;

            var channel = chat as TLChannel;

            if (channel != null)
            {
                channel.ExportedInvite    = ExportedInvite;
                channel.About             = About;
                channel.ParticipantsCount = ParticipantsCount;
                channel.AdminsCount       = AdminsCount;
                channel.KickedCount       = KickedCount;
                channel.ReadInboxMaxId    = ReadInboxMaxId;
            }

            return(chat);
        }
Beispiel #19
0
        public override void Update(TLChatBase chat)
        {
            base.Update(chat);
            var c = chat as TLChat;

            if (c != null)
            {
                _title = c.Title;
                if (Photo.GetType() != c.Photo.GetType())
                {
                    _photo = c.Photo;    // при удалении фото чата не обновляется UI при _photo = c.Photo
                }
                else
                {
                    Photo.Update(c.Photo);
                }
                ParticipantsCount = c.ParticipantsCount;
                Date    = c.Date;
                Left    = c.Left;
                Version = c.Version;
            }
        }
Beispiel #20
0
        public override void Update(TLChatBase chatBase)
        {
            base.Update(chatBase);

            var chat = chatBase as TLChat;

            if (chat != null)
            {
                Title = chat.Title;
                if (Photo.GetType() != chat.Photo.GetType())
                {
                    Photo = chat.Photo;    // при удалении фото чата не обновляется UI при _photo = c.Photo
                }
                else
                {
                    Photo.Update(chat.Photo);
                }
                ParticipantsCount = chat.ParticipantsCount;
                Date    = chat.Date;
                IsLeft  = chat.IsLeft;
                Version = chat.Version;

                Flags = chat.Flags;

                if (chat.ReadInboxMaxId != 0 && (ReadInboxMaxId == 0 || ReadInboxMaxId < chat.ReadInboxMaxId))
                {
                    ReadInboxMaxId = chat.ReadInboxMaxId;
                }
                if (chat.ReadOutboxMaxId != 0 && (ReadOutboxMaxId == 0 || ReadOutboxMaxId < chat.ReadOutboxMaxId))
                {
                    ReadOutboxMaxId = chat.ReadOutboxMaxId;
                }

                //if (c.CustomFlags != null)
                //{
                //    CustomFlags = c.CustomFlags;
                //}
            }
        }
Beispiel #21
0
        public override void Update(TLChatBase chatBase)
        {
            base.Update(chatBase);

            var channel = chatBase as TLChannel;

            if (channel != null)
            {
                if (channel.IsMin)
                {
                    // TODO: ???
                    return;
                }

                this.Flags             = channel.Flags;
                this.Id                = channel.Id;
                this.AccessHash        = channel.AccessHash;
                this.Title             = channel.Title;
                this.Username          = channel.Username;
                this.Photo             = channel.Photo;
                this.Date              = channel.Date;
                this.Version           = channel.Version;
                this.RestrictionReason = channel.RestrictionReason;
                this.AdminRights       = channel.AdminRights;
                this.BannedRights      = channel.BannedRights;
                this.ParticipantsCount = channel.ParticipantsCount;

                if (channel.ReadInboxMaxId != null)
                {
                    this.ReadInboxMaxId = channel.ReadInboxMaxId;
                }
                if (channel.ReadOutboxMaxId != null && (this.ReadOutboxMaxId == null || this.ReadOutboxMaxId.Value < channel.ReadOutboxMaxId.Value))
                {
                    this.ReadOutboxMaxId = channel.ReadOutboxMaxId;
                }
            }
        }
Beispiel #22
0
        public override TLObject FromStream(Stream input)
        {
            Chat = GetObject <TLChatBase>(input);

            return(this);
        }