Esempio n. 1
0
 public bool Execute(NntpClient context)
 {
     using (var response = context.PerformRequest(new NntpRequest(NntpCommand.ModeReader, false)))
     {
         return response.ResponseCode == NntpResponseCode.ServerReadyPostingAllowed || response.ResponseCode == NntpResponseCode.ServerReadyNoPostingAllowed;
     }
 }
Esempio n. 2
0
        public bool Execute(NntpClient context)
        {
            using (var authUserResponse = context.PerformRequest(new NntpRequest(NntpCommand.AuthUser, false, _username)))
            {
                if (authUserResponse.ResponseCode != NntpResponseCode.MoreAuthenticationInformationRequired)
                    return false;

                using (var authPassResponse = context.PerformRequest(new NntpRequest(NntpCommand.AuthPass, false, _password)))
                {
                    if (authPassResponse.ResponseCode != NntpResponseCode.AuthenticationAccepted)
                        return false;

                    return true;
                }
            }
        }
Esempio n. 3
0
 public bool Execute(NntpClient context)
 {
     using (var response = context.PerformRequest(new NntpRequest(NntpCommand.Group, false, _group)))
     {
         var success = response.ResponseCode == NntpResponseCode.NflsGroupSelected;
         if (success)
             Group = new Group(response);
         return success;
     }
 }
Esempio n. 4
0
 public bool Execute(NntpClient context)
 {
     using (var response = context.PerformRequest(new NntpRequest(NntpCommand.Stat, false, _articleId.ToString())))
     {
         var success = response.ResponseCode == NntpResponseCode.ArticleRetrievedRequestTextSeparately;
         if (success)
             Stat = new Stat(response);
         return success;
     }
 }
Esempio n. 5
0
        public bool Execute(NntpClient context)
        {
            using (var response = context.PerformRequest(new NntpRequest(NntpCommand.Quit, false)))
            {
                var success = response.ResponseCode == NntpResponseCode.ClosingConnection;
                if (success)
                {
                    try
                    {
                        var statusLine = response.StatusLine;
                        var parts = statusLine.Split(new[] { ' ' }, 2);

                        Message = parts[1];
                    }
                    catch (Exception)
                    {
                        //Ignore parse errors, server is what matters
                    }
                }
                return success;
            }
        }