Exemple #1
0
        /// 非同期でPOP3メールサーバーへListコマンドを送信します。
        /// <summary>
        /// Send asynchronous list command to pop3 server.
        /// 非同期でPOP3メールサーバーへListコマンドを送信します。
        /// </summary>
        /// <param name="callbackFunction"></param>
        /// <returns></returns>
        public void ExecuteList(Action<List<ListCommandResult>> callbackFunction)
        {
            ListCommand cm = new ListCommand();

            Action<Pop3CommandResult> md = response =>
            {
                this.CheckResponseError(response);
                List<ListCommandResult> l = new List<ListCommandResult>();
                StringReader sr = null;
                String line = "";

                sr = new StringReader(response.Text);
                while (sr.Peek() > -1)
                {
                    line = sr.ReadLine();
                    if (line == ".")
                    { break; }
                    if (line.StartsWith("+OK", StringComparison.OrdinalIgnoreCase) == true)
                    { continue; }

                    l.Add(new ListCommandResult(line));
                }
                callbackFunction(l);
            };
            this.CheckAuthenticate();
            this.BeginExecute(cm, md);
        }
Exemple #2
0
        /// 非同期でPOP3メールサーバーへListコマンドを送信します。
        /// <summary>
        /// Send asynchronous list command to pop3 server.
        /// 非同期でPOP3メールサーバーへListコマンドを送信します。
        /// </summary>
        /// <param name="mailIndex"></param>
        /// <param name="callbackFunction"></param>
        /// <returns></returns>
        public void ExecuteList(Int64 mailIndex, Action<List<ListCommandResult>> callbackFunction)
        {
            ListCommand cm = new ListCommand(mailIndex);

            Action<Pop3CommandResult> md = response =>
            {
                this.CheckResponseError(response);
                List<ListCommandResult> l = new List<ListCommandResult>();
                var rs = new ListCommandResult(response.Text);
                l.Add(rs);
                callbackFunction(l);
            };
            this.CheckAuthenticate();
            this.BeginExecute(cm, md);
        }
Exemple #3
0
        /// POP3メールサーバーへListコマンドを送信します。
        /// <summary>
        /// Send list command to pop3 server.
        /// POP3メールサーバーへListコマンドを送信します。
        /// </summary>
        /// <param name="mailIndex"></param>
        /// <returns></returns>
        public ListCommandResult ExecuteList(Int64 mailIndex)
        {
            ListCommand cm = new ListCommand(mailIndex);
            Pop3CommandResult rs = null;

            this.CheckAuthenticate();
            rs = this.Execute(cm);
            this.CheckResponseError(rs);
            return new ListCommandResult(rs.Text);
        }
Exemple #4
0
        /// POP3メールサーバーへListコマンドを送信します。
        /// <summary>
        /// Send list command to pop3 server.
        /// POP3メールサーバーへListコマンドを送信します。
        /// </summary>
        /// <returns></returns>
        public List<ListCommandResult> ExecuteList()
        {
            ListCommand cm = new ListCommand();
            List<ListCommandResult> l = new List<ListCommandResult>();
            Pop3CommandResult rs = null;
            StringReader sr = null;
            String line = "";

            this.CheckAuthenticate();
            rs = this.Execute(cm);
            this.CheckResponseError(rs);

            sr = new StringReader(rs.Text);
            while (sr.Peek() > -1)
            {
                line = sr.ReadLine();
                if (line == ".")
                { break; }
                if (line.StartsWith("+OK", StringComparison.OrdinalIgnoreCase) == true)
                { continue; }

                l.Add(new ListCommandResult(line));
            }
            return l;
        }
Exemple #5
0
 /// POP3メールサーバーへListコマンドを送信します。
 /// <summary>
 /// Send list command to pop3 server.
 /// POP3メールサーバーへListコマンドを送信します。
 /// </summary>
 /// <param name="command"></param>
 /// <returns></returns>
 public List<ListCommandResult> ExecuteList(ListCommand command)
 {
     List<ListCommandResult> l = new List<ListCommandResult>();
     if (command.MailIndex.HasValue == true)
     {
         var rs = this.ExecuteList(command.MailIndex.Value);
         l.Add(rs);
     }
     else
     {
         l = this.ExecuteList();
     }
     return l;
 }