Example #1
0
        protected override void OnCommandContinuationRequestReceived(ImapCommandContinuationRequest continuationRequest)
        {
            prevReceiveTimeout = Connection.ReceiveTimeout;

              Connection.ReceiveTimeout = 30 * 1000; // 30secs
              Connection.SetIsIdling(true);

              idleStateChangedEvent.Set();
        }
 protected override void OnCommandContinuationRequestReceived(ImapCommandContinuationRequest continuationRequest)
 {
     FinishError(ImapCommandResultCode.ResponseError, "unexpected command continuation request");
 }
        protected override void OnCommandContinuationRequestReceived(ImapCommandContinuationRequest continuationRequest)
        {
            // The authentication protocol exchange consists of a series of
              // server challenges and client responses that are specific to the
              // authentication mechanism.  A server challenge consists of a
              // command continuation request response with the "+" token followed
              // by a BASE64 encoded string.  The client response consists of a
              // single line consisting of a BASE64 encoded string.  If the client
              // wishes to cancel an authentication exchange, it issues a line
              // consisting of a single "*".  If the server receives such a
              // response, it MUST reject the AUTHENTICATE command by sending a
              // tagged BAD response.
              var serverChallenge = Base64.Decode(continuationRequest.Text);
              byte[] clientResponse;
              var status = saslMechanism.Exchange(serverChallenge, out clientResponse);

              if (status == SaslExchangeStatus.Failed || clientResponse == null)
            SendContinuation("*");
              else
            SendContinuation(Base64.GetEncodedString(clientResponse));
        }