summaryrefslogtreecommitdiff
path: root/src/lib/send_problem_report_job.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-11-06 22:37:29 +0000
committerCarl Hetherington <cth@carlh.net>2014-11-06 22:37:29 +0000
commitfa737edf632ab952ab6f2f70d4af61cca9a1da63 (patch)
treee1b5420f74aa9c74da4d15b27de5acb42ef2da9e /src/lib/send_problem_report_job.cc
parente4c1072a393a0bcc3dec7070f26915a1878392ab (diff)
Use in-tree libquickmail; send metadata.xml too; fix basic build errors with quickmail.
Diffstat (limited to 'src/lib/send_problem_report_job.cc')
-rw-r--r--src/lib/send_problem_report_job.cc43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/lib/send_problem_report_job.cc b/src/lib/send_problem_report_job.cc
index 32fec6913..b2eb4e25d 100644
--- a/src/lib/send_problem_report_job.cc
+++ b/src/lib/send_problem_report_job.cc
@@ -23,7 +23,7 @@
#include "cross.h"
#include "film.h"
#include "log.h"
-#include <quickmail.h>
+#include "quickmail.h"
#include "i18n.h"
@@ -58,27 +58,16 @@ SendProblemReportJob::run ()
quickmail_add_to (mail, "carl@dcpomatic.com");
- string body = _summary;
+ string body = _summary + "\n\n";
body += "log head and tail:\n";
body += "---<8----\n";
body += _film->log()->head_and_tail ();
body += "---<8----\n\n";
-
- FILE* ffprobe = fopen_boost (_film->file ("ffprobe.log"), "r");
- if (ffprobe) {
- body += "ffprobe.log:\n";
- body += "---<8----\n";
- uintmax_t const size = boost::filesystem::file_size (_film->file ("ffprobe.log"));
- char* buffer = new char[size + 1];
- int const N = fread (buffer, size, 1, ffprobe);
- buffer[N] = '\0';
- body += buffer;
- delete[] buffer;
- body += "---<8----\n\n";
- fclose (ffprobe);
- }
-
+
+ add_file (body, "ffprobe.log");
+ add_file (body, "metadata.xml");
+
quickmail_set_body (mail, body.c_str());
char const* error = quickmail_send (mail, "main.carlh.net", 2525, 0, 0);
@@ -94,3 +83,23 @@ SendProblemReportJob::run ()
set_progress (1);
}
+
+void
+SendProblemReportJob::add_file (string& body, boost::filesystem::path file) const
+{
+ FILE* f = fopen_boost (_film->file (file), "r");
+ if (!f) {
+ return;
+ }
+
+ body += file.string() + ":\n";
+ body += "---<8----\n";
+ uintmax_t const size = boost::filesystem::file_size (_film->file (file));
+ char* buffer = new char[size + 1];
+ int const N = fread (buffer, 1, size, f);
+ buffer[N] = '\0';
+ body += buffer;
+ delete[] buffer;
+ body += "---<8----\n\n";
+ fclose (f);
+}