diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-11-06 22:37:29 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-11-06 22:37:29 +0000 |
| commit | fa737edf632ab952ab6f2f70d4af61cca9a1da63 (patch) | |
| tree | e1b5420f74aa9c74da4d15b27de5acb42ef2da9e /src/lib | |
| parent | e4c1072a393a0bcc3dec7070f26915a1878392ab (diff) | |
Use in-tree libquickmail; send metadata.xml too; fix basic build errors with quickmail.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/kdm.cc | 2 | ||||
| -rw-r--r-- | src/lib/quickmail.cc | 8 | ||||
| -rw-r--r-- | src/lib/send_problem_report_job.cc | 43 | ||||
| -rw-r--r-- | src/lib/send_problem_report_job.h | 2 | ||||
| -rw-r--r-- | src/lib/wscript | 3 |
5 files changed, 35 insertions, 23 deletions
diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc index 108860594..3f88bbd9d 100644 --- a/src/lib/kdm.cc +++ b/src/lib/kdm.cc @@ -19,7 +19,6 @@ #include <list> #include <boost/shared_ptr.hpp> -#include <quickmail.h> #include <zip.h> #include <dcp/encrypted_kdm.h> #include <dcp/types.h> @@ -30,6 +29,7 @@ #include "film.h" #include "config.h" #include "safe_stringstream.h" +#include "quickmail.h" using std::list; using std::string; diff --git a/src/lib/quickmail.cc b/src/lib/quickmail.cc index 3de2d06ee..0b1553a34 100644 --- a/src/lib/quickmail.cc +++ b/src/lib/quickmail.cc @@ -250,7 +250,7 @@ void email_info_attachment_list_close_handles (struct email_info_attachment_list void* email_info_attachment_open_dummy (void* filedata) { - return &email_info_attachment_open_dummy; + return (void *) &email_info_attachment_open_dummy; } size_t email_info_attachment_read_dummy (void* handle, void* buf, size_t len) @@ -606,7 +606,7 @@ size_t quickmail_get_data (void* ptr, size_t size, size_t nmemb, void* userp) //generate header part char** p = &mailobj->buf; mailobj->buf = NULL; - str_append(p, "User-Agent: libquickmail v" LIBQUICKMAIL_VERSION NEWLINE); + str_append(p, "User-Agent: libquickmail"); if (mailobj->timestamp != 0) { char timestamptext[32]; if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S %z", localtime(&mailobj->timestamp))) {
@@ -701,7 +701,7 @@ size_t quickmail_get_data (void* ptr, size_t size, size_t nmemb, void* userp) } if (mailobj->buflen == 0 && mailobj->current_attachment && mailobj->current_attachment->handle) { //read body data - if ((mailobj->buf = malloc(BODY_BUFFER_SIZE)) == NULL) { + if ((mailobj->buf = (char *) malloc(BODY_BUFFER_SIZE)) == NULL) { DEBUG_ERROR(ERRMSG_MEMORY_ALLOCATION_ERROR) } if (mailobj->buf == NULL || (mailobj->buflen = mailobj->current_attachment->email_info_attachment_read(mailobj->current_attachment->handle, mailobj->buf, BODY_BUFFER_SIZE)) <= 0) { @@ -829,7 +829,7 @@ size_t quickmail_get_data (void* ptr, size_t size, size_t nmemb, void* userp) int len = (mailobj->buflen > size * nmemb ? size * nmemb : mailobj->buflen); memcpy(ptr, mailobj->buf, len); if (len < mailobj->buflen) { - mailobj->buf = memmove(mailobj->buf, mailobj->buf + len, mailobj->buflen - len); + mailobj->buf = (char *) memmove(mailobj->buf, mailobj->buf + len, mailobj->buflen - len); mailobj->buflen -= len; } else { free(mailobj->buf); 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); +} diff --git a/src/lib/send_problem_report_job.h b/src/lib/send_problem_report_job.h index 76a920ad3..d77eec544 100644 --- a/src/lib/send_problem_report_job.h +++ b/src/lib/send_problem_report_job.h @@ -34,6 +34,8 @@ public: void run (); private: + void add_file (std::string& body, boost::filesystem::path file) const; + std::string _from; std::string _summary; }; diff --git a/src/lib/wscript b/src/lib/wscript index 69483a836..0a6b79207 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -62,6 +62,7 @@ sources = """ player_video.cc playlist.cc position_image.cc + quickmail.cc ratio.cc raw_image_proxy.cc render_subtitles.cc @@ -107,7 +108,7 @@ def build(bld): AVCODEC AVUTIL AVFORMAT AVFILTER SWSCALE SWRESAMPLE BOOST_FILESYSTEM BOOST_THREAD BOOST_DATETIME BOOST_SIGNALS2 SNDFILE OPENJPEG POSTPROC TIFF MAGICK SSH DCP CXML GLIB LZMA XML++ - CURL ZIP QUICKMAIL PANGOMM CAIROMM XMLSEC SUB + CURL ZIP PANGOMM CAIROMM XMLSEC SUB """ if bld.env.TARGET_OSX: |
