Exemple #1
0
        public void ExecuteUidl(Action <List <Uidl.Result> > callbackFunction)
        {
            Uidl           cm = new Uidl();
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                List <Uidl.Result> l = new List <Uidl.Result>();
                StringReader sr      = null;
                String line          = "";

                sr = new StringReader(responseString);
                while (sr.Peek() > -1)
                {
                    line = sr.ReadLine();
                    if (line == ".")
                    {
                        break;
                    }
                    if (line.StartsWith("+OK", StringComparison.InvariantCultureIgnoreCase) == true)
                    {
                        continue;
                    }
                    if (Uidl.Result.CheckFormat(line) == false)
                    {
                        continue;
                    }

                    l.Add(new Uidl.Result(line));
                }
                callbackFunction(l);
            });
            this.CheckAuthenticate();
            this.BeginExecute(cm, md);
        }
Exemple #2
0
        public void BeginExecute(Pop3Command command, EndGetResponse callbackFunction)
        {
            AsynchronousContext cx = null;
            Boolean             IsResponseMultiLine = false;
            Boolean             IsException         = false;

            if (command is Top ||
                command is Retr ||
                command is List ||
                command is Uidl)
            {
                IsResponseMultiLine = true;
            }
            try
            {
                cx = new AsynchronousPop3ResponseContext(_ResponseEncoding, IsResponseMultiLine, callbackFunction);
                this.SendCommand(command.GetCommandString());
                this._Stream.BeginRead(cx.Buffer.Array, 0, cx.Buffer.Array.Length, this.BeginExecuteCallBack, cx);
            }
            catch
            {
                IsException = true;
                throw;
            }
            finally
            {
                if (IsException == true && cx != null)
                {
                    cx.Dispose();
                }
            }
        }
Exemple #3
0
        public void GetMessageText(Int64 mailIndex, EndGetResponse callbackFunction)
        {
            Retr           cm = null;
            EndGetResponse md = callbackFunction;

            this.CheckAuthenticate();
            cm = new Retr(mailIndex);
            this.BeginExecute(cm, md);
        }
Exemple #4
0
        public void ExecuteReset(Action <Pop3CommandResult> callbackFunction)
        {
            Rset           cm = null;
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                callbackFunction(new Pop3CommandResult(responseString));
            });
            this.CheckAuthenticate();
            cm = new Rset();
            this.BeginExecute(cm, md);
        }
Exemple #5
0
        public void ExecuteNoop(Action <Pop3CommandResult> callbackFunction)
        {
            Noop           cm = null;
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                callbackFunction(new Pop3CommandResult(responseString));
            });
            this.EnsureOpen();
            cm = new Noop();
            this.BeginExecute(cm, md);
        }
Exemple #6
0
        public void ExecuteStat(Action <Stat.Result> callbackFunction)
        {
            Stat           cm = null;
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                callbackFunction(new Stat.Result(responseString));
            });
            this.CheckAuthenticate();
            cm = new Stat();
            this.BeginExecute(cm, md);
        }
Exemple #7
0
        public void ExecuteRetr(Int64 mailIndex, Action <Pop3Message> callbackFunction)
        {
            Retr           cm = null;
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                callbackFunction(new Pop3Message(responseString, mailIndex));
            });
            this.CheckAuthenticate();
            cm = new Retr(mailIndex);
            this.BeginExecute(cm, md);
        }
Exemple #8
0
        public void ExecuteQuit(Action <Pop3CommandResult> callbackFunction)
        {
            Quit           cm = null;
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                Pop3CommandResult rs = new Pop3CommandResult(responseString);
                callbackFunction(rs);
            });
            this.EnsureOpen();
            cm = new Quit();
            this.BeginExecute(cm, md);
        }
Exemple #9
0
        public void ExecuteUidl(Int64 mailIndex, Action <Uidl.Result[]> callbackFunction)
        {
            Uidl           cm = new Uidl(mailIndex);
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                Uidl.Result[] rs = new Uidl.Result[1];
                rs[0]            = new Uidl.Result(responseString);
                callbackFunction(rs);
            });
            this.CheckAuthenticate();
            this.BeginExecute(cm, md);
        }
Exemple #10
0
        public void ExecuteList(Int64 mailIndex, Action <List <List.Result> > callbackFunction)
        {
            List           cm = new List(mailIndex);
            EndGetResponse md = null;

            md = new EndGetResponse(delegate(String responseString)
            {
                List <List.Result> l = new List <List.Result>();
                var rs = new List.Result(responseString);
                l.Add(rs);
                callbackFunction(l);
            });
            this.CheckAuthenticate();
            this.BeginExecute(cm, md);
        }
 internal AsynchronousPop3ResponseContext(Encoding encoding, Boolean isMultiLine, EndGetResponse callbackFunction) :
     base(encoding)
 {
     _IsMultiLine            = isMultiLine;
     _EndGetResponseCallback = callbackFunction;
 }