Joshi.Utils.Imap.Imap.Expunge C# (CSharp) Method

Expunge() public method

Expunge
public Expunge ( ) : void
return void
        public void Expunge()
        {
            ImapResponseEnum eImapResponse = ImapResponseEnum.IMAP_SUCCESS_RESPONSE;

            if (!m_bIsLoggedIn)
            {
                try
                {
                    Restore(false);
                }
                catch (ImapException e)
                {
                    if (e.Type != ImapException.ImapErrorEnum.IMAP_ERR_INSUFFICIENT_DATA)
                        throw e;

                    throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_NOTCONNECTED);
                }
            }
            if (!m_bIsFolderSelected && !m_bIsFolderExamined)
            {
                throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_NOTSELECTED);
            }

            ArrayList asResultArray = new ArrayList();
            string sCommand = IMAP_EXPUNGE_COMMAND;
            sCommand += IMAP_COMMAND_EOL;
            try
            {
                eImapResponse = SendAndReceive(sCommand, ref asResultArray);
                if (eImapResponse != ImapResponseEnum.IMAP_SUCCESS_RESPONSE)
                {
                    throw new ImapException(ImapException.ImapErrorEnum.IMAP_ERR_SEARCH, asResultArray[0].ToString());
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }