aboutsummaryrefslogtreecommitdiffstats
path: root/src/addressList.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2006-04-05 19:48:09 +0200
committerVincent Richard <[email protected]>2006-04-05 19:48:09 +0200
commitb16c5ca684382677ae298eed6253c75d2eaf9806 (patch)
tree50f33a0641261ac7e925640ceb142ba0ebc6df44 /src/addressList.cpp
parentRefactored and cleaned up smart pointers. (diff)
downloadvmime-b16c5ca684382677ae298eed6253c75d2eaf9806.tar.gz
vmime-b16c5ca684382677ae298eed6253c75d2eaf9806.zip
Clean up.
Diffstat (limited to 'src/addressList.cpp')
-rw-r--r--src/addressList.cpp31
1 files changed, 31 insertions, 0 deletions
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 <ref <const component> > addressList::getChildComponents() con
}
+ref <mailboxList> addressList::toMailboxList() const
+{
+ ref <mailboxList> res = vmime::create <mailboxList>();
+
+ for (std::vector <ref <address> >::const_iterator it = m_list.begin() ;
+ it != m_list.end() ; ++it)
+ {
+ ref <const address> addr = *it;
+
+ if (addr->isGroup())
+ {
+ const std::vector <ref <const mailbox> > mailboxes =
+ addr.dynamicCast <const mailboxGroup>()->getMailboxList();
+
+ for (std::vector <ref <const mailbox> >::const_iterator jt = mailboxes.begin() ;
+ jt != mailboxes.end() ; ++jt)
+ {
+ res->appendMailbox(vmime::clone(*jt));
+ }
+ }
+ else
+ {
+ res->appendMailbox(addr->clone().dynamicCast <mailbox>());
+ }
+ }
+
+ return res;
+}
+
+
} // vmime