From b16c5ca684382677ae298eed6253c75d2eaf9806 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Wed, 5 Apr 2006 17:48:09 +0000 Subject: Clean up. --- src/addressList.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/addressList.cpp') diff --git a/src/addressList.cpp b/src/addressList.cpp index 9b779d0e..dfc67a8f 100644 --- a/src/addressList.cpp +++ b/src/addressList.cpp @@ -25,6 +25,7 @@ #include "vmime/parserHelpers.hpp" #include "vmime/exception.hpp" #include "vmime/mailboxList.hpp" +#include "vmime/mailboxGroup.hpp" namespace vmime @@ -257,4 +258,34 @@ const std::vector > addressList::getChildComponents() con } +ref addressList::toMailboxList() const +{ + ref res = vmime::create (); + + for (std::vector >::const_iterator it = m_list.begin() ; + it != m_list.end() ; ++it) + { + ref addr = *it; + + if (addr->isGroup()) + { + const std::vector > mailboxes = + addr.dynamicCast ()->getMailboxList(); + + for (std::vector >::const_iterator jt = mailboxes.begin() ; + jt != mailboxes.end() ; ++jt) + { + res->appendMailbox(vmime::clone(*jt)); + } + } + else + { + res->appendMailbox(addr->clone().dynamicCast ()); + } + } + + return res; +} + + } // vmime -- cgit