/// <summary>
        /// Retrieves the article headers for the specified range.
        /// </summary>
        /// <param name="firstArticleId">The first article id.</param>
        /// <param name="lastArticleId">The last article id.</param>
        /// <returns></returns>
        public override IEnumerable <ArticleHeadersDictionary> RetrieveArticleHeaders(int firstArticleId, int lastArticleId)
        {
            if (!CurrentGroupSelected)
            {
                throw new NntpGroupNotSelectedException();
            }

            if (m_supportsXover)
            {
                string[] headerNames = new string[] { "Article-ID", "Subject", "From", "Date", "Message-ID", "Xref", "Bytes", "Lines" };
                foreach (string s in DoArticleCommand("XOVER " + firstArticleId + "-" + lastArticleId, 224))
                {
                    ArticleHeadersDictionary headers = new ArticleHeadersDictionary();
                    string[] fields = s.Split('\t');

                    for (int i = 0; i < headerNames.Length; i++)
                    {
                        headers.AddHeader(headerNames[i], fields[i]);
                    }
                    yield return(headers);
                }
            }
            else
            {
                // I can't use the base class to do this.
                for (; firstArticleId < lastArticleId; firstArticleId++)
                {
                    yield return(RetrieveArticleHeader(firstArticleId));
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves the article header common functionality. The command argument
        /// should be in the form "HEAD [article-id|message-id]."
        /// </summary>
        /// <param name="command">The command.</param>
        /// <returns></returns>
        protected ArticleHeadersDictionary RetrieveArticleHeaderCore(string command)
        {
            ArticleHeadersDictionary headers = new ArticleHeadersDictionary();

            foreach (string s in DoArticleCommand(command, Rfc977ResponseCodes.ArticleRetrievedHeadFollows))
            {
                if (s.Length == 0)
                {
                    break;
                }
                else
                {
                    headers.AddHeader(s);
                }
            }
            return(headers);
        }