Ejemplo n.º 1
0
        /// <summary>
        /// Uidls the specified list.
        /// </summary>
        /// <param name="List">The list.</param>
        public void Uidl(Pop3MessageInfoList List)
        {
            Pop3UIDInfoList pop3UIDLInfoList = this.Uidl();

            for (int iIndex = 0; iIndex < pop3UIDLInfoList.Count; iIndex++)
            {
                List[iIndex].UID = pop3UIDLInfoList[iIndex].UID;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Request message list, result is in the form (response, ['mesg_num octets', ...]). If which is set, it is the message to list.
        /// </summary>
        public Pop3MessageInfoList List()
        {
            //			CLIENT: LIST
            //			SERVER: +ОК 2 messages (320 octets)
            //			SERVER: 1 120
            //			SERVER: 2 200
            //			SERVER: . ...
            this.SendCommand("LIST\r\n");
            string statResponse = this.ReadOKResponse();

            Pop3MessageInfoList list = new Pop3MessageInfoList();

            while (true)
            {
                string responseLine = ReadLine();

                if (responseLine.StartsWith("."))
                {
                    break;
                }

                string[] NumArray = responseLine.Split(_Delimiter);
                if (NumArray.Length != 2)
                {
                    throw new Pop3ServerIncorectAnswerException();
                }

                Pop3MessageInfo message = null;

                try
                {
                    message = new Pop3MessageInfo(Int32.Parse(NumArray[0]), null, Int32.Parse(NumArray[1]));
                }
                catch (Exception ex)
                {
                    throw new Pop3ServerIncorectAnswerException("Incorect response format.", ex);
                }

                list.Add(message);
            }

            return(list);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Uidls the specified list.
        /// </summary>
        /// <param name="List">The list.</param>
        public void Uidl(Pop3MessageInfoList List)
        {
            Pop3UIDInfoList pop3UIDLInfoList = this.Uidl();

            for (int iIndex = 0; iIndex < pop3UIDLInfoList.Count; iIndex++)
            {
                List[iIndex].UID = pop3UIDLInfoList[iIndex].UID;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Request message list, result is in the form (response, ['mesg_num octets', ...]). If which is set, it is the message to list. 
        /// </summary>
        public Pop3MessageInfoList List()
        {
            //			CLIENT: LIST
            //			SERVER: +ОК 2 messages (320 octets)
            //			SERVER: 1 120
            //			SERVER: 2 200
            //			SERVER: . ...
            this.SendCommand("LIST\r\n");
            string statResponse = this.ReadOKResponse();

            Pop3MessageInfoList list = new Pop3MessageInfoList();

            while (true)
            {
                string responseLine = ReadLine();

                if (responseLine.StartsWith("."))
                    break;

                string[] NumArray = responseLine.Split(_Delimiter);
                if (NumArray.Length != 2)
                    throw new Pop3ServerIncorectAnswerException();

                Pop3MessageInfo message = null;

                try
                {
                    message = new Pop3MessageInfo(Int32.Parse(NumArray[0]), null, Int32.Parse(NumArray[1]));
                }
                catch (Exception ex)
                {
                    throw new Pop3ServerIncorectAnswerException("Incorect response format.", ex);
                }

                list.Add(message);
            }

            return list;
        }