/// <summary> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </summary> /// <remarks> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="algorithm">The threading algorithm.</param> /// <param name="messages">The messages.</param> /// <param name="orderBy">The requested sort ordering.</param> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="messages"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="orderBy"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="messages"/> contains one or more items that is missing information needed for threading or sorting. /// </exception> public static IList <MessageThread> Thread(ThreadingAlgorithm algorithm, IEnumerable <IThreadable> messages, OrderBy[] orderBy) { if (messages == null) { throw new ArgumentNullException("messages"); } if (orderBy == null) { throw new ArgumentNullException("orderBy"); } switch (algorithm) { case ThreadingAlgorithm.OrderedSubject: return(ThreadBySubject(messages, orderBy)); case ThreadingAlgorithm.References: return(ThreadByReferences(messages, orderBy)); default: throw new ArgumentOutOfRangeException("algorithm"); } }
/// <summary> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </summary> /// <remarks> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="messages">The messages.</param> /// <param name="algorithm">The threading algorithm.</param> /// <param name="orderBy">The requested sort ordering.</param> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="messages"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="orderBy"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <para><paramref name="messages"/> contains one or more items that is missing information needed for threading or sorting.</para> /// <para>-or-</para> /// <para><paramref name="orderBy"/> is an empty list.</para> /// </exception> public static IList <MessageThread> Thread(this IEnumerable <IMessageSummary> messages, ThreadingAlgorithm algorithm, IList <OrderBy> orderBy) { if (messages == null) { throw new ArgumentNullException(nameof(messages)); } if (orderBy == null) { throw new ArgumentNullException(nameof(orderBy)); } if (orderBy.Count == 0) { throw new ArgumentException("No sort order provided.", nameof(orderBy)); } switch (algorithm) { case ThreadingAlgorithm.OrderedSubject: return(ThreadBySubject(messages, orderBy)); case ThreadingAlgorithm.References: return(ThreadByReferences(messages, orderBy)); default: throw new ArgumentOutOfRangeException(nameof(algorithm)); } }
/// <summary> /// Thread the messages according to the specified threading algorithm. /// </summary> /// <remarks> /// Thread the messages according to the specified threading algorithm. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="messages">The messages.</param> /// <param name="algorithm">The threading algorithm.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="messages"/> is <c>null</c>. /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="messages"/> contains one or more items that is missing information needed for threading. /// </exception> public static IList <MessageThread> Thread(this IEnumerable <IMessageSummary> messages, ThreadingAlgorithm algorithm) { return(Thread(messages, algorithm, new [] { OrderBy.Arrival })); }
/// <summary> /// Thread the messages according to the specified threading algorithm. /// </summary> /// <remarks> /// Thread the messages according to the specified threading algorithm. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="algorithm">The threading algorithm.</param> /// <param name="messages">The messages.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="messages"/> is <c>null</c>. /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="messages"/> contains one or more items that is missing information needed for threading. /// </exception> public static IList <MessageThread> Thread(ThreadingAlgorithm algorithm, IEnumerable <IThreadable> messages) { return(Thread(algorithm, messages, new [] { OrderBy.Arrival })); }
/// <summary> /// Asynchronously thread the messages in the folder that match the search query using the specified threading algorithm. /// </summary> /// <remarks> /// The <see cref="MessageThread.UniqueId"/> can be used with methods such as /// <see cref="IMailFolder.GetMessage(UniqueId,CancellationToken,ITransferProgress)"/>. /// </remarks> /// <returns>An array of message threads.</returns> /// <param name="uids">The subset of UIDs</param> /// <param name="algorithm">The threading algorithm to use.</param> /// <param name="query">The search query.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not supported. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="uids"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="query"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentException"> /// <para><paramref name="uids"/> is empty.</para> /// <para>-or-</para> /// <para>One or more of the <paramref name="uids"/> is invalid.</para> /// </exception> /// <exception cref="System.NotSupportedException"> /// <para>One or more search terms in the <paramref name="query"/> are not supported by the mail store.</para> /// <para>-or-</para> /// <para>The server does not support the THREAD extension.</para> /// </exception> /// <exception cref="System.ObjectDisposedException"> /// The <see cref="IMailStore"/> has been disposed. /// </exception> /// <exception cref="ServiceNotConnectedException"> /// The <see cref="IMailStore"/> is not connected. /// </exception> /// <exception cref="ServiceNotAuthenticatedException"> /// The <see cref="IMailStore"/> is not authenticated. /// </exception> /// <exception cref="FolderNotOpenException"> /// The folder is not currently open. /// </exception> /// <exception cref="System.OperationCanceledException"> /// The operation was canceled via the cancellation token. /// </exception> /// <exception cref="System.IO.IOException"> /// An I/O error occurred. /// </exception> /// <exception cref="ProtocolException"> /// The server's response contained unexpected tokens. /// </exception> /// <exception cref="CommandException"> /// The command failed. /// </exception> public virtual Task<IList<MessageThread>> ThreadAsync (IList<UniqueId> uids, ThreadingAlgorithm algorithm, SearchQuery query, CancellationToken cancellationToken = default (CancellationToken)) { if (uids == null) throw new ArgumentNullException ("uids"); if (uids.Count == 0) throw new ArgumentException ("No uids were specified.", "uids"); if (query == null) throw new ArgumentNullException ("query"); return Task.Factory.StartNew (() => { lock (SyncRoot) { return Thread (uids, algorithm, query, cancellationToken); } }, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default); }
/// <summary> /// Threads the messages in the folder that match the search query using the specified threading algorithm. /// </summary> /// <remarks> /// The <see cref="MessageThread.UniqueId"/> can be used with methods such as /// <see cref="IMailFolder.GetMessage(UniqueId,CancellationToken,ITransferProgress)"/>. /// </remarks> /// <returns>An array of message threads.</returns> /// <param name="uids">The subset of UIDs</param> /// <param name="algorithm">The threading algorithm to use.</param> /// <param name="query">The search query.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not supported. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="uids"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="query"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentException"> /// <para><paramref name="uids"/> is empty.</para> /// <para>-or-</para> /// <para>One or more of the <paramref name="uids"/> is invalid.</para> /// </exception> /// <exception cref="System.NotSupportedException"> /// <para>One or more search terms in the <paramref name="query"/> are not supported by the IMAP server.</para> /// <para>-or-</para> /// <para>The server does not support the THREAD extension.</para> /// </exception> /// <exception cref="System.ObjectDisposedException"> /// The <see cref="ImapClient"/> has been disposed. /// </exception> /// <exception cref="ServiceNotConnectedException"> /// The <see cref="ImapClient"/> is not connected. /// </exception> /// <exception cref="ServiceNotAuthenticatedException"> /// The <see cref="ImapClient"/> is not authenticated. /// </exception> /// <exception cref="FolderNotOpenException"> /// The <see cref="ImapFolder"/> is not currently open. /// </exception> /// <exception cref="System.OperationCanceledException"> /// The operation was canceled via the cancellation token. /// </exception> /// <exception cref="System.IO.IOException"> /// An I/O error occurred. /// </exception> /// <exception cref="ImapProtocolException"> /// The server's response contained unexpected tokens. /// </exception> /// <exception cref="ImapCommandException"> /// The server replied with a NO or BAD response. /// </exception> public override IList<MessageThread> Thread (IList<UniqueId> uids, ThreadingAlgorithm algorithm, SearchQuery query, CancellationToken cancellationToken = default (CancellationToken)) { var method = algorithm.ToString ().ToUpperInvariant (); var set = ImapUtils.FormatUidSet (uids); var args = new List<string> (); string charset; if ((Engine.Capabilities & ImapCapabilities.Thread) == 0) throw new NotSupportedException ("The IMAP server does not support the THREAD extension."); if (!Engine.ThreadingAlgorithms.Contains (algorithm)) throw new ArgumentOutOfRangeException ("algorithm", "The specified threading algorithm is not supported."); if (query == null) throw new ArgumentNullException ("query"); CheckState (true, false); var optimized = query.Optimize (new ImapSearchQueryOptimizer ()); var expr = BuildQueryExpression (optimized, args, out charset); var command = "UID THREAD " + method + " " + charset + " "; command += "UID " + set + " " + expr + "\r\n"; var ic = new ImapCommand (Engine, cancellationToken, this, command, args.ToArray ()); ic.RegisterUntaggedHandler ("THREAD", ThreadMatches); Engine.QueueCommand (ic); Engine.Wait (ic); ProcessResponseCodes (ic, null); if (ic.Response != ImapCommandResponse.Ok) throw ImapCommandException.Create ("THREAD", ic); var threads = (IList<MessageThread>) ic.UserData; if (threads == null) return new MessageThread[0]; return threads; }
/// <summary> /// Asynchronously thread the messages in the folder that match the search query using the specified threading algorithm. /// </summary> /// <remarks> /// The <see cref="MessageThread.UniqueId"/> can be used with methods such as /// <see cref="IMailFolder.GetMessage(UniqueId,CancellationToken,ITransferProgress)"/>. /// </remarks> /// <returns>An array of message threads.</returns> /// <param name="algorithm">The threading algorithm to use.</param> /// <param name="query">The search query.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not supported. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <paramref name="query"/> is <c>null</c>. /// </exception> /// <exception cref="System.NotSupportedException"> /// <para>One or more search terms in the <paramref name="query"/> are not supported by the mail store.</para> /// <para>-or-</para> /// <para>The server does not support the THREAD extension.</para> /// </exception> /// <exception cref="System.ObjectDisposedException"> /// The <see cref="IMailStore"/> has been disposed. /// </exception> /// <exception cref="ServiceNotConnectedException"> /// The <see cref="IMailStore"/> is not connected. /// </exception> /// <exception cref="ServiceNotAuthenticatedException"> /// The <see cref="IMailStore"/> is not authenticated. /// </exception> /// <exception cref="FolderNotOpenException"> /// The folder is not currently open. /// </exception> /// <exception cref="System.OperationCanceledException"> /// The operation was canceled via the cancellation token. /// </exception> /// <exception cref="System.IO.IOException"> /// An I/O error occurred. /// </exception> /// <exception cref="ProtocolException"> /// The server's response contained unexpected tokens. /// </exception> /// <exception cref="CommandException"> /// The command failed. /// </exception> public virtual Task<IList<MessageThread>> ThreadAsync (ThreadingAlgorithm algorithm, SearchQuery query, CancellationToken cancellationToken = default (CancellationToken)) { if (query == null) throw new ArgumentNullException ("query"); return Task.Factory.StartNew (() => { lock (SyncRoot) { return Thread (algorithm, query, cancellationToken); } }, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default); }
/// <summary> /// Thread the messages in the folder that match the search query using the specified threading algorithm. /// </summary> /// <remarks> /// The <see cref="MessageThread.UniqueId"/> can be used with methods such as /// <see cref="IMailFolder.GetMessage(UniqueId,CancellationToken,ITransferProgress)"/>. /// </remarks> /// <returns>An array of message threads.</returns> /// <param name="uids">The subset of UIDs</param> /// <param name="algorithm">The threading algorithm to use.</param> /// <param name="query">The search query.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not supported. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="uids"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="query"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentException"> /// <para><paramref name="uids"/> is empty.</para> /// <para>-or-</para> /// <para>One or more of the <paramref name="uids"/> is invalid.</para> /// </exception> /// <exception cref="System.NotSupportedException"> /// <para>One or more search terms in the <paramref name="query"/> are not supported by the mail store.</para> /// <para>-or-</para> /// <para>The server does not support the THREAD extension.</para> /// </exception> /// <exception cref="System.ObjectDisposedException"> /// The <see cref="IMailStore"/> has been disposed. /// </exception> /// <exception cref="ServiceNotConnectedException"> /// The <see cref="IMailStore"/> is not connected. /// </exception> /// <exception cref="ServiceNotAuthenticatedException"> /// The <see cref="IMailStore"/> is not authenticated. /// </exception> /// <exception cref="FolderNotOpenException"> /// The folder is not currently open. /// </exception> /// <exception cref="System.OperationCanceledException"> /// The operation was canceled via the cancellation token. /// </exception> /// <exception cref="System.IO.IOException"> /// An I/O error occurred. /// </exception> /// <exception cref="ProtocolException"> /// The server's response contained unexpected tokens. /// </exception> /// <exception cref="CommandException"> /// The command failed. /// </exception> public abstract IList<MessageThread> Thread (IList<UniqueId> uids, ThreadingAlgorithm algorithm, SearchQuery query, CancellationToken cancellationToken = default (CancellationToken));
/// <summary> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </summary> /// <remarks> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="messages">The messages.</param> /// <param name="algorithm">The threading algorithm.</param> /// <param name="orderBy">The requested sort ordering.</param> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="messages"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="orderBy"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <para><paramref name="messages"/> contains one or more items that is missing information needed for threading or sorting.</para> /// <para>-or-</para> /// <para><paramref name="orderBy"/> is an empty list.</para> /// </exception> public static IList<MessageThread> Thread (this IEnumerable<IMessageSummary> messages, ThreadingAlgorithm algorithm, IList<OrderBy> orderBy) { if (messages == null) throw new ArgumentNullException ("messages"); if (orderBy == null) throw new ArgumentNullException ("orderBy"); if (orderBy.Count == 0) throw new ArgumentException ("No sort order provided.", "orderBy"); switch (algorithm) { case ThreadingAlgorithm.OrderedSubject: return ThreadBySubject (messages, orderBy); case ThreadingAlgorithm.References: return ThreadByReferences (messages, orderBy); default: throw new ArgumentOutOfRangeException ("algorithm"); } }
/// <summary> /// Threads the messages in the folder that match the search query using the specified threading algorithm. /// </summary> /// <remarks> /// The <see cref="MessageThread.UniqueId"/> can be used with <see cref="IFolder.GetMessage(UniqueId,CancellationToken)"/>. /// </remarks> /// <returns>An array of message threads.</returns> /// <param name="algorithm">The threading algorithm to use.</param> /// <param name="query">The search query.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not supported. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <paramref name="query"/> is <c>null</c>. /// </exception> /// <exception cref="System.NotSupportedException"> /// <para>One or more search terms in the <paramref name="query"/> are not supported by the IMAP server.</para> /// <para>-or-</para> /// <para>The server does not support the THREAD extension.</para> /// </exception> /// <exception cref="System.ObjectDisposedException"> /// The <see cref="ImapClient"/> has been disposed. /// </exception> /// <exception cref="System.InvalidOperationException"> /// <para>The <see cref="ImapClient"/> is not connected.</para> /// <para>-or-</para> /// <para>The <see cref="ImapClient"/> is not authenticated.</para> /// <para>-or-</para> /// <para>The folder is not currently open.</para> /// </exception> /// <exception cref="System.OperationCanceledException"> /// The operation was canceled via the cancellation token. /// </exception> /// <exception cref="System.IO.IOException"> /// An I/O error occurred. /// </exception> /// <exception cref="ImapProtocolException"> /// The server's response contained unexpected tokens. /// </exception> /// <exception cref="ImapCommandException"> /// The server replied with a NO or BAD response. /// </exception> public MessageThread[] Thread(ThreadingAlgorithm algorithm, SearchQuery query, CancellationToken cancellationToken) { var method = algorithm.ToString ().ToUpperInvariant (); var args = new List<string> (); if ((Engine.Capabilities & ImapCapabilities.Thread) == 0) throw new NotSupportedException ("The IMAP server does not support the THREAD extension."); if (!Engine.ThreadingAlgorithms.Contains (algorithm)) throw new ArgumentOutOfRangeException ("algorithm", "The specified threading algorithm is not supported."); if (query == null) throw new ArgumentNullException ("query"); CheckState (true, false); var optimized = query.Optimize (new ImapSearchQueryOptimizer ()); var expr = BuildQueryExpression (optimized, args); var command = "UID THREAD " + method + " UTF-8 "; command += expr + "\r\n"; var ic = Engine.QueueCommand (cancellationToken, this, command, args.ToArray ()); ic.RegisterUntaggedHandler ("THREAD", ThreadMatches); Engine.Wait (ic); ProcessResponseCodes (ic, null); if (ic.Result != ImapCommandResult.Ok) throw new ImapCommandException ("THREAD", ic.Result); return (MessageThread[]) ic.UserData; }
/// <summary> /// Thread the messages according to the specified threading algorithm. /// </summary> /// <remarks> /// Thread the messages according to the specified threading algorithm. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="messages">The messages.</param> /// <param name="algorithm">The threading algorithm.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="messages"/> is <c>null</c>. /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="messages"/> contains one or more items that is missing information needed for threading. /// </exception> public static IList<MessageThread> Thread (this IEnumerable<IMessageSummary> messages, ThreadingAlgorithm algorithm) { return Thread (messages, algorithm, new [] { OrderBy.Arrival }); }
/// <summary> /// Thread the messages according to the specified threading algorithm. /// </summary> /// <remarks> /// Thread the messages according to the specified threading algorithm. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="algorithm">The threading algorithm.</param> /// <param name="messages">The messages.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="messages"/> is <c>null</c>. /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="messages"/> contains one or more items that is missing information needed for threading. /// </exception> public static IList<MessageThread> Thread (ThreadingAlgorithm algorithm, IEnumerable<IThreadable> messages) { return Thread (algorithm, messages, new [] { OrderBy.Arrival }); }
/// <summary> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </summary> /// <remarks> /// Threads the messages according to the specified threading algorithm /// and sorts the resulting threads by the specified ordering. /// </remarks> /// <returns>The threaded messages.</returns> /// <param name="algorithm">The threading algorithm.</param> /// <param name="messages">The messages.</param> /// <param name="orderBy">The requested sort ordering.</param> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="messages"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="orderBy"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not a valid threading algorithm. /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="messages"/> contains one or more items that is missing information needed for threading or sorting. /// </exception> public static IList<MessageThread> Thread (ThreadingAlgorithm algorithm, IEnumerable<IThreadable> messages, OrderBy[] orderBy) { if (messages == null) throw new ArgumentNullException ("messages"); if (orderBy == null) throw new ArgumentNullException ("orderBy"); switch (algorithm) { case ThreadingAlgorithm.OrderedSubject: return ThreadBySubject (messages, orderBy); case ThreadingAlgorithm.References: return ThreadByReferences (messages, orderBy); default: throw new ArgumentOutOfRangeException ("algorithm"); } }
/// <summary> /// Threads the messages in the folder that match the search query using the specified threading algorithm. /// </summary> /// <remarks> /// The <see cref="MessageThread.UniqueId"/> can be used with <see cref="IFolder.GetMessage(UniqueId,CancellationToken)"/>. /// </remarks> /// <returns>An array of message threads.</returns> /// <param name="uids">The subset of UIDs</param> /// <param name="algorithm">The threading algorithm to use.</param> /// <param name="query">The search query.</param> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not supported. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <para><paramref name="uids"/> is <c>null</c>.</para> /// <para>-or-</para> /// <para><paramref name="query"/> is <c>null</c>.</para> /// </exception> /// <exception cref="System.ArgumentException"> /// <paramref name="uids"/> contains one or more invalid UIDs. /// </exception> /// <exception cref="System.NotSupportedException"> /// <para>One or more search terms in the <paramref name="query"/> are not supported by the IMAP server.</para> /// <para>-or-</para> /// <para>The server does not support the THREAD extension.</para> /// </exception> /// <exception cref="System.ObjectDisposedException"> /// The <see cref="ImapClient"/> has been disposed. /// </exception> /// <exception cref="System.InvalidOperationException"> /// <para>The <see cref="ImapClient"/> is not connected.</para> /// <para>-or-</para> /// <para>The <see cref="ImapClient"/> is not authenticated.</para> /// <para>-or-</para> /// <para>The folder is not currently open.</para> /// </exception> /// <exception cref="System.IO.IOException"> /// An I/O error occurred. /// </exception> /// <exception cref="ImapProtocolException"> /// The server's response contained unexpected tokens. /// </exception> /// <exception cref="ImapCommandException"> /// The server replied with a NO or BAD response. /// </exception> public MessageThread[] Thread(UniqueId[] uids, ThreadingAlgorithm algorithm, SearchQuery query) { return Thread (uids, algorithm, query, CancellationToken.None); }
/// <summary> /// Threads the messages in the folder that match the search query using the specified threading algorithm. /// </summary> /// <remarks> /// The <see cref="MessageThread.UniqueId"/> can be used with <see cref="IFolder.GetMessage(UniqueId,CancellationToken)"/>. /// </remarks> /// <returns>An array of message threads.</returns> /// <param name="algorithm">The threading algorithm to use.</param> /// <param name="query">The search query.</param> /// <exception cref="System.ArgumentOutOfRangeException"> /// <paramref name="algorithm"/> is not supported. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <paramref name="query"/> is <c>null</c>. /// </exception> /// <exception cref="System.NotSupportedException"> /// <para>One or more search terms in the <paramref name="query"/> are not supported by the IMAP server.</para> /// <para>-or-</para> /// <para>The server does not support the THREAD extension.</para> /// </exception> /// <exception cref="System.ObjectDisposedException"> /// The <see cref="ImapClient"/> has been disposed. /// </exception> /// <exception cref="System.InvalidOperationException"> /// <para>The <see cref="ImapClient"/> is not connected.</para> /// <para>-or-</para> /// <para>The <see cref="ImapClient"/> is not authenticated.</para> /// <para>-or-</para> /// <para>The folder is not currently open.</para> /// </exception> /// <exception cref="System.IO.IOException"> /// An I/O error occurred. /// </exception> /// <exception cref="ImapProtocolException"> /// The server's response contained unexpected tokens. /// </exception> /// <exception cref="ImapCommandException"> /// The server replied with a NO or BAD response. /// </exception> public MessageThread[] Thread(ThreadingAlgorithm algorithm, SearchQuery query) { return Thread (algorithm, query, CancellationToken.None); }