Example #1
0
        internal PopWebResponse(PopCommandResult r)
            : base()
        {
            this.DropList = PopDropListing.Empty;
              this.ScanLists = new PopScanListing[] {};
              this.UniqueIdLists = new PopUniqueIdListing[] {};
              this.RetrievedMessageStream = null;

              this.Result = r;
        }
 public PopAuthenticationException(PopCommandResult result)
     : base(string.Format("authentication failed {0} (result code:{1})", result.ResultText, result.Code), result)
 {
 }
 public PopErrorResponseException(string message, Exception innerException)
     : base(message, innerException)
 {
     this.result = null;
 }
 public PopErrorResponseException(string message, PopCommandResult result)
     : base(message)
 {
     this.result = result;
 }
 public PopErrorResponseException(PopCommandResult result)
     : this(string.Format("{0}: {1}", result.Code, result.ResultText), result)
 {
 }
 public PopErrorResponseException()
     : base()
 {
     this.result = null;
 }
 internal static void ThrowIfError(PopCommandResult result)
 {
     if (result.Failed)
     throw new PopErrorResponseException(result);
 }
Example #8
0
        private PopSession GetSession(out PopCommandResult noopResult)
        {
            noopResult = null;

              var s = sessionManager.GetExistSession(requestUri);

              if (s != null) {
            if (s.IsDisposed) {
              s = null;
            }
            else if (s.IsTransactionProceeding) {
              throw new WebException("another transaction proceeding", WebExceptionStatus.Pending);
            }
            else {
              try {
            // check connected
            if (s.State != PopSessionState.NotConnected)
              noopResult = s.NoOp();
              }
              catch {
            // ignore exception
              }

              // disconnected
              if (s.IsDisposed || s.State == PopSessionState.NotConnected) {
            sessionManager.UnregisterSession(requestUri);
            s = null;
            noopResult = null;
              }
            }
              }

              if (s == null) {
            var session = PopSessionManager.CreateSession(this);

            if (keepAlive)
              sessionManager.RegisterSession(requestUri, session);

            s = session;
              }

              this.session = s;

              return s;
        }