Beispiel #1
0
        private void setGroupUnit_Finished(AsciiProtocolUnit unit)
        {
            AsciiSendLineGetLineUnit setGroupUnit = (AsciiSendLineGetLineUnit)unit;

            _responseLine = setGroupUnit.ResponseLine;
            string error = null;

            if (_responseLine == null)
            {
                if (_connection.LastSocketException != null)
                {
                    error = _connection.LastSocketException.Message;
                }
                else
                {
                    error = "Newsgroup could not be processed";
                }
            }
            else if (!_responseLine.StartsWith("211"))
            {
                if (_responseLine.Length > 4)
                {
                    error = _responseLine.Substring(4);
                }
                else
                {
                    error = "Newsgroup could not be processed";
                }
            }
            ResourceProxy proxy = new ResourceProxy(_group.Resource);

            if (error != null)
            {
                proxy.SetPropAsync(Core.Props.LastError, error);
            }
            else
            {
                proxy.DeletePropAsync(Core.Props.LastError);
            }
            FireFinished();
        }
Beispiel #2
0
 public NntpConnection(ServerResource server)
     : base(server.Name, server.Port)
 {
     _server       = server;
     _serverProxy  = new ResourceProxy(server.Resource);
     this.Timeout  = Timeout = Core.SettingStore.ReadInt("NNTP", "Timeout", 60) * 1000;
     TraceProtocol = Settings.Trace;
     SSL3Enabled   = server.SSL3Enabled;
     _state        = NntpConnectionState.Connecting;
     System.Diagnostics.Trace.WriteLine(Server + ":" + Port + ": Connecting to server...");
     _serverProxy.DeletePropAsync(Core.Props.LastError);
     DoConnect();
     if (!_server.Resource.IsDeleted)
     {
         string username = _server.LoginName;
         if (username.Length > 0)
         {
             DoAuthenticate(username, _server.Password);
         }
         StartUnit(Int32.MaxValue, new AsciiSendLineGetLineUnit("mode reader"));
     }
 }