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); }
public IMailMessage FetchMail(int messageNumber) { if (m_CurrentState is DisconnectedState) { if (!Connect()) { return(new mime.RFC2045.NullMessage()); } } if (m_CurrentState is AuthorizationState) { if (!Authenticate()) { return(new mime.RFC2045.NullMessage()); } } RFC1939.RetriveCommand command = new RFC1939.RetriveCommand(m_Stream, messageNumber); if (IssueCommand(command)) { IMailMessage message; lock (m_Stream) { message = m_MailReader.Read(ref m_Stream, this); } this.CurrentState = TransactionState.GetInstance(); return(message); } return(new mime.RFC2045.NullMessage()); }