/// <summary> /// Retrieves the newsgroups. /// </summary> /// <returns></returns> public virtual IEnumerable <NewsgroupHeader> RetrieveNewsgroups() { foreach (string s in DoBasicCommand("LIST", Rfc977ResponseCodes.NewsgroupsFollow)) { yield return(NewsgroupHeader.Parse(s)); } }
/// <summary> /// Retrieves the newsgroups. /// </summary> /// <param name="wildcardMatch">The wildcard match.</param> /// <returns></returns> public virtual IEnumerable <NewsgroupHeader> RetrieveNewsgroups(string wildcardMatch) { if (m_supportsListActive) { foreach (string s in DoBasicCommand("LIST ACTIVE " + wildcardMatch, Rfc977ResponseCodes.NewsgroupsFollow)) { yield return(NewsgroupHeader.Parse(s)); } } else { throw new NotImplementedException(); } }
/// <summary> /// Retrieves the newsgroups. /// </summary> /// <returns></returns> public override IEnumerable <NewsgroupHeader> RetrieveNewsgroups() { if (m_supportsListActive) { foreach (string s in DoBasicCommand("LIST ACTIVE", Rfc977ResponseCodes.NewsgroupsFollow)) { yield return(NewsgroupHeader.Parse(s)); } } else { // I can't use the base class to do this. foreach (string s in DoBasicCommand("LIST", Rfc977ResponseCodes.NewsgroupsFollow)) { yield return(NewsgroupHeader.Parse(s)); } } }
/// <summary> /// Retrieves the new newsgroups. /// </summary> /// <param name="dateTime">The value time.</param> /// <param name="timeZone">The time zone.</param> /// <param name="distributions">The distributions.</param> /// <returns></returns> public virtual IEnumerable <NewsgroupHeader> RetrieveNewNewsgroups(DateTime dateTime, TimeZoneOption timeZone, string distributions) { string command = string.Format("NEWGROUPS {0:yyMMdd} {0:HHmmss}", dateTime); if (timeZone == TimeZoneOption.UseGreenwichMeanTime) { command += " GMT"; } if (!string.IsNullOrEmpty(distributions)) { command += " "; command += distributions; } foreach (string s in DoBasicCommand(command, Rfc977ResponseCodes.NewNewsgroupsFollow)) { yield return(NewsgroupHeader.Parse(s)); } }
/// <summary> /// Parses the specified response. /// </summary> /// <param name="response">The response.</param> /// <returns></returns> public static NewsgroupHeader Parse(string response) { if (response == null) { throw new ArgumentNullException("response"); } string[] parts = response.Split(new char[] { ' ' }); if (parts.Length < 3) { throw new ArgumentException(Resource.ErrorMessage13); } NewsgroupHeader h = new NewsgroupHeader(); h.m_groupName = parts[0]; h.m_lastArticleId = Rfc977NntpClient.ConvertToInt32(parts[1]); h.m_firstArticleId = Rfc977NntpClient.ConvertToInt32(parts[2]); h.m_statusCode = ((parts.Length > 3 && parts[3].Length > 0) ? h.m_statusCode = parts[3][0] : 'y'); return(h); }
/// <summary> /// Parses the specified response. /// </summary> /// <param name="response">The response.</param> /// <returns></returns> public static NewsgroupHeader Parse(string response) { if (response == null) { throw new ArgumentNullException("response"); } string[] parts = response.Split(new char[] { ' ' }); if (parts.Length < 3) { throw new ArgumentException(Resource.ErrorMessage13); } NewsgroupHeader h = new NewsgroupHeader(); h.m_groupName = parts[0]; h.m_lastArticleId = Rfc977NntpClient.ConvertToInt32(parts[1]); h.m_firstArticleId = Rfc977NntpClient.ConvertToInt32(parts[2]); h.m_statusCode = ((parts.Length > 3 && parts[3].Length > 0) ? h.m_statusCode = parts[3][0] : 'y'); return h; }