Stop double-calculation of hashes.
[dcpomatic.git] / src / lib / screen.cc
index 0876e770b03b4cd43b86d8d4892f11f45ec4a718..159c4326bc5b08e7e4ad26af87cffd7f54391efe 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "screen.h"
 #include <libxml++/libxml++.h>
+#include <boost/foreach.hpp>
 
 Screen::Screen (cxml::ConstNodePtr node)
        : name (node->string_child ("Name"))
@@ -28,6 +29,10 @@ Screen::Screen (cxml::ConstNodePtr node)
        } else if (node->optional_string_child ("Recipient")) {
                recipient = dcp::Certificate (node->string_child ("Recipient"));
        }
+
+       BOOST_FOREACH (cxml::ConstNodePtr i, node->node_children ("TrustedDevice")) {
+               trusted_devices.push_back (dcp::Certificate (i->content ()));
+       }
 }
 
 void
@@ -37,4 +42,8 @@ Screen::as_xml (xmlpp::Element* parent) const
        if (recipient) {
                parent->add_child("Recipient")->add_child_text (recipient->certificate (true));
        }
+
+       BOOST_FOREACH (dcp::Certificate const & i, trusted_devices) {
+               parent->add_child("TrustedDevice")->add_child_text (i.certificate (true));
+       }
 }