More enum class additions.
[dcpomatic.git] / src / lib / send_problem_report_job.cc
index 3c0bc47aac58fba1fc5d87d4a108702c99b91528..7f60a3fdc2e8e91239a2ff92753a31e621af3ecd 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2017 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 #include "version.h"
 #include "emailer.h"
 #include "environment_info.h"
-#include <boost/foreach.hpp>
+#include <libxml++/libxml++.h>
 
 #include "i18n.h"
 
 using std::string;
 using std::list;
-using boost::shared_ptr;
+using std::shared_ptr;
 
-/** @param film Film thta the problem is with, or 0 */
+/** @param film Film thta the problem is with, or 0.
+ *  @param from Email address to use for From:
+ *  @param summary Summary of the problem.
+ */
 SendProblemReportJob::SendProblemReportJob (
        shared_ptr<const Film> film,
        string from,
@@ -48,6 +51,11 @@ SendProblemReportJob::SendProblemReportJob (
 
 }
 
+SendProblemReportJob::~SendProblemReportJob ()
+{
+       stop_thread ();
+}
+
 string
 SendProblemReportJob::name () const
 {
@@ -72,9 +80,9 @@ SendProblemReportJob::run ()
 
        string body = _summary + "\n\n";
 
-       body += "Version: " + string (dcpomatic_version) + " " + string (dcpomatic_git_commit) + "\n\n";
+       body += "Version: " + string(dcpomatic_version) + " " + string(dcpomatic_git_commit) + "\n\n";
 
-       BOOST_FOREACH (string i, environment_info ()) {
+       for (auto i: environment_info ()) {
                body += i + "\n";
        }
 
@@ -87,14 +95,14 @@ SendProblemReportJob::run ()
                body += "---<8----\n\n";
 
                add_file (body, "ffprobe.log");
-               add_file (body, "metadata.xml");
-       }
 
-       list<string> to;
-       to.push_back ("carl@dcpomatic.com");
+               body += "---<8----\n";
+               body += _film->metadata()->write_to_string_formatted("UTF-8");
+               body += "---<8----\n";
+       }
 
-       Emailer emailer (_from, to, "DCP-o-matic problem report", body);
-       emailer.send ("main.carlh.net", 2525);
+       Emailer emailer (_from, {"carl@dcpomatic.com"}, "DCP-o-matic problem report", body);
+       emailer.send ("main.carlh.net", 2525, EmailProtocol::STARTTLS);
 
        set_progress (1);
        set_state (FINISHED_OK);