Basic support for trusted device lists in KDMs (#750).
[dcpomatic.git] / src / tools / dcpomatic_kdm_cli.cc
index aa3022c30a5c205edb037732b62befc9ee108f46..2f8212a619fe2acc0e5035ea93b3d04031ff67a4 100644 (file)
@@ -27,6 +27,7 @@
 #include "lib/cinema_kdms.h"
 #include "lib/config.h"
 #include "lib/exceptions.h"
+#include "lib/emailer.h"
 #include "lib/safe_stringstream.h"
 #include <dcp/certificate.h>
 #include <getopt.h>
@@ -189,7 +190,7 @@ int main (int argc, char* argv[])
        if (cinemas) {
                list<boost::shared_ptr<Cinema> > cinemas = Config::instance()->cinemas ();
                for (list<boost::shared_ptr<Cinema> >::const_iterator i = cinemas.begin(); i != cinemas.end(); ++i) {
-                       cout << (*i)->name << " (" << (*i)->email << ")\n";
+                       cout << (*i)->name << " (" << Emailer::address_list ((*i)->emails) << ")\n";
                }
                exit (EXIT_SUCCESS);
        }
@@ -254,7 +255,7 @@ int main (int argc, char* argv[])
                }
 
                dcp::Certificate certificate (dcp::file_to_string (certificate_file));
-               dcp::EncryptedKDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get(), formulation);
+               dcp::EncryptedKDM kdm = film->make_kdm (certificate, vector<dcp::Certificate>(), cpl, valid_from.get(), valid_to.get(), formulation);
                kdm.as_xml (output);
                if (verbose) {
                        cout << "Generated KDM " << output << " for certificate.\n";
@@ -263,7 +264,11 @@ int main (int argc, char* argv[])
 
                list<shared_ptr<Cinema> > cinemas = Config::instance()->cinemas ();
                list<shared_ptr<Cinema> >::const_iterator i = cinemas.begin();
-               while (i != cinemas.end() && (*i)->name != cinema_name && (*i)->email != cinema_name) {
+               while (
+                       i != cinemas.end() &&
+                       (*i)->name != cinema_name &&
+                       find ((*i)->emails.begin(), (*i)->emails.end(), cinema_name) == (*i)->emails.end()) {
+
                        ++i;
                }