Пример #1
0
        /// <summary>
        /// Creates the response.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <returns>
        /// The <c>Pop3Response</c> containing the results of the
        /// Pop3 command execution.
        /// </returns>
        protected override StatResponse CreateResponse(byte[] buffer)
        {
            Pop3Response response = Pop3Response.CreateResponse(buffer);

            string[] values = response.HostMessage.Split(' ');

            //should consist of '+OK', 'messagecount', 'octets'
            if (values.Length < 3)
            {
                throw new Pop3Exception(string.Concat("Invalid response message: ", response.HostMessage));
            }

            int  messageCount = Convert.ToInt32(values[1]);
            long octets       = Convert.ToInt64(values[2]);

            return(new StatResponse(response, messageCount, octets));
        }
Пример #2
0
        /// <summary>
        /// Creates the response.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <returns>
        /// The <c>Pop3Response</c> containing the results of the
        /// Pop3 command execution.
        /// </returns>
        protected override ConnectResponse CreateResponse(byte[] buffer)
        {
            Pop3Response response = Pop3Response.CreateResponse(buffer);

            return(new ConnectResponse(response, NetworkStream));
        }