// // MailSpool.cs // // Author: Jeffrey Stedfast // // Copyright (c) 2013-2020 .NET Foundation and Contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using System.IO; using System.Threading; using System.Collections; using System.Threading.Tasks; using System.Collections.Generic; using MimeKit; namespace MailKit { /// /// An abstract mail spool implementation. /// /// /// An abstract mail spool implementation. /// public abstract class MailSpool : MailService, IMailSpool { /// /// Initializes a new instance of the class. /// /// /// Initializes a new instance of the class. /// /// The protocol logger. /// /// is null. /// protected MailSpool (IProtocolLogger protocolLogger) : base (protocolLogger) { } /// /// Get the number of messages available in the message spool. /// /// /// Gets the number of messages available in the message spool. /// Once authenticated, the property will be set /// to the number of available messages in the spool. /// /// /// /// /// The message count. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// public abstract int Count { get; } /// /// Get whether or not the service supports referencing messages by UIDs. /// /// /// Not all servers support referencing messages by UID, so this property should /// be checked before using /// and . /// If the server does not support UIDs, then all methods that take UID arguments /// along with and /// will fail. /// /// true if supports uids; otherwise, false. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// public abstract bool SupportsUids { get; } /// /// Get the message count. /// /// /// Gets the message count. /// /// The message count. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract int GetMessageCount (CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously get the message count. /// /// /// Asynchronously gets the message count. /// /// The message count. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task GetMessageCountAsync (CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the UID of the message at the specified index. /// /// /// Not all servers support UIDs, so you should first check /// the property. /// /// The message UID. /// The message index. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The mail spool does not support UIDs. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract string GetMessageUid (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously get the UID of the message at the specified index. /// /// /// Not all servers support UIDs, so you should first check /// the property. /// /// The message UID. /// The message index. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The mail spool does not support UIDs. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task GetMessageUidAsync (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the full list of available message UIDs. /// /// /// Not all servers support UIDs, so you should first check /// the property. /// /// /// /// /// The message uids. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The mail spool does not support UIDs. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetMessageUids (CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the full list of available message UIDs. /// /// /// Not all servers support UIDs, so you should first check /// the property. /// /// The message uids. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The mail spool does not support UIDs. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetMessageUidsAsync (CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the size of the specified message, in bytes. /// /// /// Gets the size of the specified message, in bytes. /// /// The message size, in bytes. /// The index of the message. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract int GetMessageSize (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously get the size of the specified message, in bytes. /// /// /// Asynchronously gets the size of the specified message, in bytes. /// /// The message size, in bytes. /// The index of the message. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task GetMessageSizeAsync (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the sizes for all available messages, in bytes. /// /// /// Gets the sizes for all available messages, in bytes. /// /// The message sizes, in bytes. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetMessageSizes (CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously get the sizes for all available messages, in bytes. /// /// /// Asynchronously gets the sizes for all available messages, in bytes. /// /// The message sizes, in bytes. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetMessageSizesAsync (CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the headers for the specified message. /// /// /// Gets the headers for the specified message. /// /// The message headers. /// The index of the message. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract HeaderList GetMessageHeaders (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously get the headers for the specified message. /// /// /// Asynchronously gets the headers for the specified message. /// /// The message headers. /// The index of the message. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task GetMessageHeadersAsync (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the headers for the specified messages. /// /// /// Gets the headers for the specified messages. /// /// The headers for the specified messages. /// The indexes of the messages. /// The cancellation token. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetMessageHeaders (IList indexes, CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously get the headers for the specified messages. /// /// /// Asynchronously gets the headers for the specified messages. /// /// The headers for the specified messages. /// The indexes of the messages. /// The cancellation token. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetMessageHeadersAsync (IList indexes, CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the headers of the messages within the specified range. /// /// /// Gets the headers of the messages within the specified range. /// /// The headers of the messages within the specified range. /// The index of the first message to get. /// The number of messages to get. /// The cancellation token. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetMessageHeaders (int startIndex, int count, CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the headers of the messages within the specified range. /// /// /// Gets the headers of the messages within the specified range. /// /// The headers of the messages within the specified range. /// The index of the first message to get. /// The number of messages to get. /// The cancellation token. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetMessageHeadersAsync (int startIndex, int count, CancellationToken cancellationToken = default (CancellationToken)); /// /// Get the message at the specified index. /// /// /// Gets the message at the specified index. /// /// /// /// /// The message. /// The index of the message. /// The cancellation token. /// The progress reporting mechanism. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract MimeMessage GetMessage (int index, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously get the message at the specified index. /// /// /// Asynchronously gets the message at the specified index. /// /// The message. /// The index of the message. /// The cancellation token. /// The progress reporting mechanism. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task GetMessageAsync (int index, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Get the messages at the specified indexes. /// /// /// Get the messages at the specified indexes. /// /// The messages. /// The indexes of the messages. /// The cancellation token. /// The progress reporting mechanism. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetMessages (IList indexes, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously get the messages at the specified indexes. /// /// /// Asynchronously get the messages at the specified indexes. /// /// The messages. /// The indexes of the messages. /// The cancellation token. /// The progress reporting mechanism. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetMessagesAsync (IList indexes, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Get the messages within the specified range. /// /// /// Gets the messages within the specified range. /// /// /// /// /// The messages. /// The index of the first message to get. /// The number of messages to get. /// The cancellation token. /// The progress reporting mechanism. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetMessages (int startIndex, int count, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously get the messages within the specified range. /// /// /// Asynchronously gets the messages within the specified range. /// /// The messages. /// The index of the first message to get. /// The number of messages to get. /// The cancellation token. /// The progress reporting mechanism. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetMessagesAsync (int startIndex, int count, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Get the message or header stream at the specified index. /// /// /// Gets the message or header stream at the specified index. /// /// The message or header stream. /// The index of the message. /// true if only the headers should be retrieved; otherwise, false. /// The cancellation token. /// The progress reporting mechanism. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Stream GetStream (int index, bool headersOnly = false, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously get the message or header stream at the specified index. /// /// /// Asynchronously gets the message or header stream at the specified index. /// /// The message or header stream. /// The index of the message. /// true if only the headers should be retrieved; otherwise, false. /// The cancellation token. /// The progress reporting mechanism. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task GetStreamAsync (int index, bool headersOnly = false, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Get the message or header streams at the specified indexes. /// /// /// Get the message or header streams at the specified indexes. /// If the mail server supports pipelining, this method will likely be more /// efficient than using for /// each message because it will batch the commands to reduce latency. /// /// The message or header streams. /// The indexes of the messages. /// true if only the headers should be retrieved; otherwise, false. /// The cancellation token. /// The progress reporting mechanism. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetStreams (IList indexes, bool headersOnly = false, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously get the message or header streams at the specified indexes. /// /// /// Asynchronously get the message or header streams at the specified indexes. /// /// The messages. /// The indexes of the messages. /// true if only the headers should be retrieved; otherwise, false. /// The cancellation token. /// The progress reporting mechanism. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetStreamsAsync (IList indexes, bool headersOnly = false, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Get the message or header streams within the specified range. /// /// /// Gets the message or header streams within the specified range. /// If the mail server supports pipelining, this method will likely be more /// efficient than using for /// each message because it will batch the commands to reduce latency. /// /// The message or header streams. /// The index of the first stream to get. /// The number of streams to get. /// true if only the headers should be retrieved; otherwise, false. /// The cancellation token. /// The progress reporting mechanism. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract IList GetStreams (int startIndex, int count, bool headersOnly = false, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Asynchronously get the message or header streams within the specified range. /// /// /// Asynchronously gets the message or header streams within the specified range. /// /// The messages. /// The index of the first stream to get. /// The number of streams to get. /// true if only the headers should be retrieved; otherwise, false. /// The cancellation token. /// The progress reporting mechanism. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task> GetStreamsAsync (int startIndex, int count, bool headersOnly = false, CancellationToken cancellationToken = default (CancellationToken), ITransferProgress progress = null); /// /// Mark the specified message for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// /// /// /// The index of the message. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract void DeleteMessage (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously mark the specified message for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// An asynchronous task context. /// The index of the message. /// The cancellation token. /// /// is not a valid message index. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task DeleteMessageAsync (int index, CancellationToken cancellationToken = default (CancellationToken)); /// /// Mark the specified messages for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// The indexes of the messages. /// The cancellation token. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract void DeleteMessages (IList indexes, CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously mark the specified messages for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// An asynchronous task context. /// The indexes of the messages. /// The cancellation token. /// /// is null. /// /// /// One or more of the are invalid. /// -or- /// No indexes were specified. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task DeleteMessagesAsync (IList indexes, CancellationToken cancellationToken = default (CancellationToken)); /// /// Mark the specified range of messages for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// /// /// /// The index of the first message to mark for deletion. /// The number of messages to mark for deletion. /// The cancellation token. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract void DeleteMessages (int startIndex, int count, CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously mark the specified range of messages for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// An asynchronous task context. /// The index of the first message to mark for deletion. /// The number of messages to mark for deletion. /// The cancellation token. /// /// and do not specify /// a valid range of messages. /// /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task DeleteMessagesAsync (int startIndex, int count, CancellationToken cancellationToken = default (CancellationToken)); /// /// Mark all messages for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract void DeleteAllMessages (CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously mark all messages for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// An asynchronous task context. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task DeleteAllMessagesAsync (CancellationToken cancellationToken = default (CancellationToken)); /// /// Reset the state of all messages marked for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract void Reset (CancellationToken cancellationToken = default (CancellationToken)); /// /// Asynchronously reset the state of all messages marked for deletion. /// /// /// Messages marked for deletion are not actually deleted until the session /// is cleanly disconnected /// (see ). /// /// An asynchronous task context. /// The cancellation token. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// The command failed. /// /// /// A protocol error occurred. /// public abstract Task ResetAsync (CancellationToken cancellationToken = default (CancellationToken)); /// /// Get an enumerator for the messages in the folder. /// /// /// Gets an enumerator for the messages in the folder. /// /// The enumerator. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// A command failed. /// /// /// A protocol error occurred. /// public abstract IEnumerator GetEnumerator (); /// /// Get an enumerator for the messages in the folder. /// /// /// Gets an enumerator for the messages in the folder. /// /// The enumerator. /// /// The has been disposed. /// /// /// The is not connected. /// /// /// The is not authenticated. /// /// /// The operation was canceled via the cancellation token. /// /// /// An I/O error occurred. /// /// /// A command failed. /// /// /// A protocol error occurred. /// IEnumerator IEnumerable.GetEnumerator () { return GetEnumerator (); } } }