protected override void OnTaggedStatusResponseReceived(ImapTaggedStatusResponse tagged)
        {
            if (tagged.Condition == ImapResponseCondition.Ok) {
            //    If the server issues an OK response, the server MUST compress
            //    starting immediately after the CRLF which ends the tagged OK
            //    response.  (Responses issued by the server before the OK response
            //    will, of course, still be uncompressed.)  If the server issues a BAD
            //    or NO response, the server MUST NOT turn on compression.
            Connection.UpgradeStream(createDecompressingStreamCallback);

            FinishOk(tagged);
              }
              else {
            base.OnTaggedStatusResponseReceived(tagged);
              }
        }
        protected override void OnTaggedStatusResponseReceived(ImapTaggedStatusResponse tagged)
        {
            if (tagged.Condition == ImapResponseCondition.Ok) {
            // 6.2.1. STARTTLS Command
            //       A [TLS] negotiation begins immediately after the CRLF at the end
            //       of the tagged OK response from the server.  Once a client issues a
            //       STARTTLS command, it MUST NOT issue further commands until a
            //       server response is seen and the [TLS] negotiation is complete.
            try {
              Connection.UpgradeStream(createAuthenticatedStreamCallback);
            }
            catch (ImapUpgradeConnectionException ex) {
              throw new ImapSecureConnectionException(ex.Message, ex);
            }

            Connection.SetIsSecureConnection(true);

            FinishOk(tagged);
              }
              else {
            base.OnTaggedStatusResponseReceived(tagged);
              }
        }
 protected override void OnTaggedStatusResponseReceived(ImapTaggedStatusResponse tagged)
 {
     FinishError(ImapCommandResultCode.ResponseError, "unexpected tagged status response");
 }
Beispiel #4
0
        protected override void OnTaggedStatusResponseReceived(ImapTaggedStatusResponse tagged)
        {
            Connection.SetIsIdling(false);

              idleStateChangedEvent.Set();

              base.OnTaggedStatusResponseReceived(tagged);
        }
 protected override void OnTaggedStatusResponseReceived(ImapTaggedStatusResponse tagged)
 {
     if (tagged.Condition == ImapResponseCondition.Ok)
     FinishOk(tagged);
       else
     base.OnTaggedStatusResponseReceived(tagged);
 }
        private bool ProcessMailboxRefferalResponse(ImapTaggedStatusResponse tagged)
        {
            if (tagged == null)
            return false;
              else if (tagged.Condition != ImapResponseCondition.No)
            return false;
              else if (tagged.ResponseText.Code != ImapResponseCode.Referral)
            return false;

              // RFC 2193 IMAP4 Mailbox Referrals
              // http://tools.ietf.org/html/rfc2193
              // 4.1. SELECT, EXAMINE, DELETE, SUBSCRIBE, UNSUBSCRIBE, STATUS and APPEND
              //      Referrals
              //    An IMAP4 server MAY respond to the SELECT, EXAMINE, DELETE,
              //    SUBSCRIBE, UNSUBSCRIBE, STATUS or APPEND command with one or more
              //    IMAP mailbox referrals to indicate to the client that the mailbox is
              //    hosted on a remote server.

              // 4.2. CREATE Referrals
              //    An IMAP4 server MAY respond to the CREATE command with one or more
              //    IMAP mailbox referrals, if it wishes to direct the client to issue
              //    the CREATE against another server.  The server can employ any means,
              //    such as examining the hierarchy of the specified mailbox name, in
              //    determining which server the mailbox should be created on.

              // 4.3. RENAME Referrals
              //    An IMAP4 server MAY respond to the RENAME command with one or more
              //    pairs of IMAP mailbox referrals.  In each pair of IMAP mailbox
              //    referrals, the first one is an URL to the existing mailbox name and
              //    the second is an URL to the requested new mailbox name.

              // 4.4. COPY Referrals
              //    An IMAP4 server MAY respond to the COPY command with one or more IMAP
              //    mailbox referrals.  This indicates that the destination mailbox is on
              //    a remote server.  To achieve the same behavior of a server COPY, the
              //    client MAY issue the constituent FETCH and APPEND commands against
              //    both servers.
              var referrals = ImapResponseTextConverter.FromReferral(tagged.ResponseText);

              if (handlesReferralAsException) {
            throw new ImapMailboxReferralException(string.Format("try another server: '{0}'", tagged.ResponseText.Text),
                                               referrals);
              }
              else {
            Trace.Info("mailbox referral: '{0}'", tagged.ResponseText.Text);
            Trace.Info("  try mailboxes below:");

            foreach (var referral in referrals) {
              Trace.Info("    {0}", referral);
            }
              }

              return true;
        }