diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-11-13 13:07:16 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-11-13 13:07:16 +0000 |
| commit | df89a39cfd34d0d70609daa214d3b618bb6223bd (patch) | |
| tree | 1629307cc535fc0ea8804ca935022dddf163135d /src/lib/cinema.cc | |
| parent | 43800d83434697a31bdfae62dd377cfc3900986b (diff) | |
Allow multiple recipients of KDM emails (#745).
Diffstat (limited to 'src/lib/cinema.cc')
| -rw-r--r-- | src/lib/cinema.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index 11bc888da..ebd716009 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -21,15 +21,18 @@ #include "screen.h" #include <libcxml/cxml.h> #include <libxml++/libxml++.h> +#include <boost/foreach.hpp> using std::list; +using std::string; using boost::shared_ptr; Cinema::Cinema (cxml::ConstNodePtr node) : name (node->string_child ("Name")) - , email (node->string_child ("Email")) { - + BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children("Email")) { + emails.push_back (i->content ()); + } } /* This is necessary so that we can use shared_from_this in add_screen (which cannot be done from @@ -48,10 +51,13 @@ void Cinema::as_xml (xmlpp::Element* parent) const { parent->add_child("Name")->add_child_text (name); - parent->add_child("Email")->add_child_text (email); - for (list<shared_ptr<Screen> >::const_iterator i = _screens.begin(); i != _screens.end(); ++i) { - (*i)->as_xml (parent->add_child ("Screen")); + BOOST_FOREACH (string i, emails) { + parent->add_child("Email")->add_child_text (i); + } + + BOOST_FOREACH (shared_ptr<Screen> i, _screens) { + i->as_xml (parent->add_child ("Screen")); } } |
