Esempio n. 1
0
        public virtual IAsyncResult BeginFetchMail(int messageNumber, AsyncCallback callBack, object state)
        {
            if (m_CurrentState is DisconnectedState)
            {
                if (!Connect())
                {
                    return(null);
                }
            }

            if (m_CurrentState is AuthorizationState)
            {
                if (!Authenticate())
                {
                    return(null);
                }
            }

            RFC1939.RetriveCommand command = new RFC1939.RetriveCommand(m_Stream, messageNumber);
            if (IssueCommand(command))
            {
                ReadMailDelegate readelegate = new ReadMailDelegate(m_MailReader.Read);
                return(readelegate.BeginInvoke(ref m_Stream, this, callBack, state));
            }
            return(null);
        }
Esempio n. 2
0
        public IMailMessage EndFetchMail(IAsyncResult result)
        {
            ReadMailDelegate readDelegate = ((AsyncResult)result).AsyncDelegate as ReadMailDelegate;

            this.CurrentState = TransactionState.GetInstance();
            if (readDelegate != null)
            {
                return(readDelegate.EndInvoke(ref m_Stream, result));
            }
            return(new mime.RFC2045.NullMessage());
        }