예제 #1
0
        protected override void OnStatusResponseReceived(PopStatusResponse status)
        {
            if (status.Status == PopStatusIndicator.Positive) {
            // 4. POP3 STARTTLS extension
            //              A TLS negotiation begins immediately after the CRLF at the
            //              end of the +OK response from the server.  A -ERR response
            //              MAY result if a security layer is already active.  Once a
            //              client issues a STLS command, it MUST NOT issue further
            //              commands until a server response is seen and the TLS
            //              negotiation is complete.
            Connection.UpgradeStream(createAuthenticatedStreamCallback);

            Connection.SetIsSecureConnection(true);
              }

              base.OnStatusResponseReceived(status);
        }
예제 #2
0
        public static string FromGreetingBanner(PopStatusResponse response)
        {
            /*
               * 7. Optional POP3 Commands
               * APOP
               *    A POP3 server which implements the APOP command will
               *    include a timestamp in its banner greeting.  The syntax of
               *    the timestamp corresponds to the `msg-id' in [RFC822]
               */
              var start = response.Text.IndexOf('<');

              if (start < 0)
            return null;

              var end = response.Text.IndexOf('>', start);

              if (end <= start)
            throw new PopMalformedResponseException("invalid banner greeting");

              return response.Text.Substring(start, end - start + 1);
        }
예제 #3
0
 /*
  * 5. The TRANSACTION State
  * LIST
  *    In order to simplify parsing, all POP3 servers are
  *    required to use a certain format for scan listings.  A
  *    scan listing consists of the message-number of the
  *    message, followed by a single space and the exact size of
  *    the message in octets.  Methods for calculating the exact
  *    size of the message are described in the "Message Format"
  *    section below.  This memo makes no requirement on what
  *    follows the message size in the scan listing.  Minimal
  *    implementations should just end that line of the response
  *    with a CRLF pair.  More advanced implementations may
  *    include other information, as parsed from the message.
  */
 public static PopScanListing FromList(PopStatusResponse response)
 {
     /*
        * 5. The TRANSACTION State
        * LIST
        *    If an argument was given and the POP3 server issues a
        *    positive response with a line containing information for
        *    that message.  This line is called a "scan listing" for
        *    that message.
        */
       return PopTextConverter.ToScanListing(SplitDataOrThrow(response, 2));
 }
예제 #4
0
 /*
  * 7. Optional POP3 Commands
  * UIDL
  *    In order to simplify parsing, all POP3 servers are required to
  *    use a certain format for unique-id listings.  A unique-id
  *    listing consists of the message-number of the message,
  *    followed by a single space and the unique-id of the message.
  *    No information follows the unique-id in the unique-id listing.
  */
 public static PopUniqueIdListing FromUidl(PopStatusResponse response)
 {
     /*
        * 7. Optional POP3 Commands
        * UIDL
        *    If an argument was given and the POP3 server issues a positive
        *    response with a line containing information for that message.
        *    This line is called a "unique-id listing" for that message.
        */
       return PopTextConverter.ToUniqueIdListing(SplitDataOrThrow(response, 2));
 }
예제 #5
0
 public static PopDropListing FromStat(PopStatusResponse response)
 {
     /*
        * 5. The TRANSACTION State
        * STAT
        *    In order to simplify parsing, all POP3 servers are
        *    required to use a certain format for drop listings.  The
        *    positive response consists of "+OK" followed by a single
        *    space, the number of messages in the maildrop, a single
        *    space, and the size of the maildrop in octets.  This memo
        *    makes no requirement on what follows the maildrop size.
        *    Minimal implementations should just end that line of the
        *    response with a CRLF pair.  More advanced implementations
        *    may include other information.
        */
       return PopTextConverter.ToDropListing(SplitDataOrThrow(response, 2));
 }