예제 #1
0
        private void ParseInboxInfo(String inbox, ref EmailInbox emailInbox)
        {
            String inboxInfo = inbox.Substring(inbox.IndexOf('('));

            emailInbox.Flags = inboxInfo.Substring(1, inboxInfo.IndexOf(')') - 1);
            inboxInfo        = inboxInfo.Substring(inboxInfo.IndexOf('\"'));
            emailInbox.Name  = inboxInfo.Split(' ')[1].Trim('\"');
        }
예제 #2
0
        public List <EmailInbox> GetInboxList()
        {
            List <EmailInbox> emailInboxes = new List <EmailInbox>();
            char          delimiter;
            List <String> inboxes = m_connection.GetRootInboxList(out delimiter);

            if (inboxes == null)
            {
                return(emailInboxes);
            }

            foreach (String inbox in inboxes)
            {
                EmailInbox emailInbox = new EmailInbox();
                ParseInboxInfo(inbox, ref emailInbox);
                if (emailInbox.Flags.Contains(@"\Noselect"))
                {
                    List <String> subInboxes = m_connection.GetInboxList(emailInbox.Name, delimiter);
                    if (subInboxes == null)
                    {
                        continue;
                    }

                    foreach (String subInbox in subInboxes)
                    {
                        EmailInbox emailSubInbox = new EmailInbox();
                        ParseInboxInfo(subInbox, ref emailSubInbox);
                        emailSubInbox.Name = emailSubInbox.Name.Substring(emailSubInbox.Name.IndexOf(delimiter) + 1);
                        emailInboxes.Add(emailSubInbox);
                    }
                }
                else
                {
                    emailInboxes.Add(emailInbox);
                }
            }
            return(emailInboxes);
        }