Beispiel #1
0
        /// <summary>
        /// Marks message history as read.
        /// </summary>
        /// <param name="contact">Target user</param>
        /// <param name="offset">Value from (messages.affectedHistory) or 0</param>
        /// <param name="maxId">If a positive value is passed, only messages with identifiers less or equal than the given one will be read</param>
        /// <returns>Object contains info on affected part of communication history with the user or in a chat.</returns>
        public async Task <MessagesAffectedHistory> MarkedMessagesAsReadAsync(Models.Contact contact, int offset, int maxId = -1)
        {
            InputPeer peer = null;

            if (contact.IsForeign)
            {
                peer = new InputPeerForeignConstructor(contact.Id, contact.AccessHash);
            }
            else
            {
                peer = new InputPeerContactConstructor(contact.Id);
            }

            await ConnectAsync();

            return(await _client.ReadHistory(peer, offset, maxId));
        }