Example #1
0
        /// <summary>
        /// Gets all headers for the specified article
        /// </summary>
        /// <param name="article">message id</param>
        /// <returns>NntpHeaderList all headers</returns>
        /// <exception cref="NntpException"></exception>
        public NntpHeaderList GetArticleHeaders(String article)
        {
            if (String.IsNullOrEmpty(article)) throw new ArgumentNullException("article");

            NntpHeaderList headers = new NntpHeaderList();

            Write(String.Format("HEAD <{0}>", article));

            String response = Response();

            String responseCode = response.Substring(0, 3);
            if (responseCode != "221")
            {
                throw new NntpException(response, 221, Int32.Parse(responseCode));
            }

            //consider adding in a progress event in here somewhere
            while (true)
            {
                response = Response();

                if (response == ".\r\n" || response == ".\n")
                {
                    break;
                }

                String[] parts = response.Split(new[] { ':' }, 2);

                headers.Add(parts[0].Trim(), parts[1].Trim());
            }

            return headers;
        }
 public NntpArticle()
 {
     Headers = new NntpHeaderList();
     ID      = "";
     Body    = "";
 }
Example #3
0
 public NntpArticle()
 {
     Headers = new NntpHeaderList();
     ID = "";
     Body = "";
 }