Use in-tree libquickmail; send metadata.xml too; fix basic build errors with quickmail.
authorCarl Hetherington <cth@carlh.net>
Thu, 6 Nov 2014 22:37:29 +0000 (22:37 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 6 Nov 2014 22:37:29 +0000 (22:37 +0000)
src/lib/kdm.cc
src/lib/quickmail.cc
src/lib/send_problem_report_job.cc
src/lib/send_problem_report_job.h
src/lib/wscript
src/tools/wscript
wscript

index 108860594e2592144760965a02aeb1220f8cf02c..3f88bbd9dbefe5748db4efb3a369b8b9e02d57d0 100644 (file)
@@ -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;
index 3de2d06eeb7f9164a0bd3e1f1896a7cf0c7177f4..0b1553a342ad3f6133a8c46157e2b8189a4f9abe 100644 (file)
@@ -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))) {\r
@@ -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);
index 32fec69138fca3ecfca901ba7db98105feba0a40..b2eb4e25dcbf72bde9dfddb897b761ba3f1e7cbc 100644 (file)
@@ -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);
+}
index 76a920ad3a3acfc003ffbc5b48b7a1220d803d04..d77eec5445ca347a8c621ef1ff39e33be4bfa4a9 100644 (file)
@@ -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;
 };
index 69483a836441b9f9d87d6f9d8f8eb6068ace1ab2..0a6b7920719fdbe6fe989eff5fe3269c46ebd2e3 100644 (file)
@@ -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:
index 3811bf7600ab19f4bc1bb1c5b2f45a15a633b996..c671aadb4c04c454b59c1117b336c207c73d672e 100644 (file)
@@ -11,7 +11,7 @@ def configure(conf):
 def build(bld):
     for t in ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test', 'dcpomatic_kdm', 'dcpomatic_create']:
         obj = bld(features = 'cxx cxxprogram')
-        obj.uselib = 'BOOST_THREAD BOOST_DATETIME OPENJPEG DCP CXML AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC WXWIDGETS QUICKMAIL SUB'
+        obj.uselib = 'BOOST_THREAD BOOST_DATETIME OPENJPEG DCP CXML AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC WXWIDGETS SUB'
         obj.includes = ['..']
         obj.use    = ['libdcpomatic2']
         obj.source = '%s.cc' % t
@@ -22,7 +22,7 @@ def build(bld):
     if not bld.env.DISABLE_GUI:
         for t in ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server']:
             obj = bld(features = 'cxx cxxprogram')
-            obj.uselib = 'BOOST_THREAD BOOST_DATETIME OPENJPEG DCP CXML AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML WXWIDGETS QUICKMAIL SUB'
+            obj.uselib = 'BOOST_THREAD BOOST_DATETIME OPENJPEG DCP CXML AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML WXWIDGETS SUB'
             if bld.env.BUILD_STATIC:
                 obj.uselib += ' GTK'
             obj.includes = ['..']
diff --git a/wscript b/wscript
index 18b23df46e9f75ac9ea171adb053cbd7500d0ca0..4b1f78e4b69d518a292ae3877ff6725d24801946 100644 (file)
--- a/wscript
+++ b/wscript
@@ -158,17 +158,6 @@ def static_boost(conf, lib_suffix):
     conf.env.STLIB_BOOST_DATETIME = ['boost_date_time%s' % lib_suffix, 'boost_system%s' % lib_suffix]
     conf.env.STLIB_BOOST_SIGNALS2 = ['boost_signals2']
 
-def dynamic_quickmail(conf):
-    conf.check_cxx(fragment="""
-                            #include <quickmail.h>
-                            int main(void) { quickmail_initialize (); }
-                            """,
-                   mandatory=True,
-                   msg='Checking for libquickmail',
-                   libpath='/usr/local/lib',
-                   lib=['quickmail', 'curl'],
-                   uselib_store='QUICKMAIL')
-
 def configure(conf):
     conf.load('compiler_cxx')
     if conf.options.target_windows:
@@ -271,7 +260,6 @@ def configure(conf):
         conf.env.STLIB_CXML = ['cxml']
         conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
-        conf.env.STLIB_QUICKMAIL = ['quickmail']
         static_ffmpeg(conf)
         static_openjpeg(conf)
         static_sub(conf)
@@ -285,8 +273,6 @@ def configure(conf):
         conf.check_cfg(package='libcurl', args='--cflags --libs-only-L', uselib_store='CURL', mandatory=True)
         conf.env.STLIB_CURL = ['curl']
         conf.env.LIB_CURL = ['ssh2', 'idn']
-        conf.env.STLIB_QUICKMAIL = ['quickmail', 'curl']
-        conf.env.LIB_QUICKMAIL = ['ssh2', 'idn']
         static_ffmpeg(conf)
         static_openjpeg(conf)
         static_sub(conf)
@@ -298,7 +284,6 @@ def configure(conf):
         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags', uselib_store='CXML', mandatory=True)
         conf.env.STLIB_CXML = ['cxml']
         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
-        conf.env.STLIB_QUICKMAIL = ['quickmail']
         conf.env.LIB_SSH = ['gssapi_krb5']
         conf.env.LIB_XMLPP = ['xml2']
         conf.env.LIB_XMLSEC = ['ltdl']
@@ -318,7 +303,6 @@ def configure(conf):
                                 libpath='/usr/local/lib',
                                 lib=['boost_locale%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
                                 uselib_store='BOOST_LOCALE')
-        dynamic_quickmail(conf)
         dynamic_boost(conf, boost_lib_suffix, boost_thread)
         dynamic_ffmpeg(conf)
         dynamic_openjpeg(conf)
@@ -331,7 +315,6 @@ def configure(conf):
         conf.check_cfg(package='libcxml', atleast_version='0.08', args='--cflags --libs', uselib_store='CXML', mandatory=True)
         conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
         conf.check_cfg(package='libcurl', args='--cflags --libs', uselib_store='CURL', mandatory=True)
-        dynamic_quickmail(conf)
         dynamic_boost(conf, boost_lib_suffix, boost_thread)
         dynamic_ffmpeg(conf)
         dynamic_dcp(conf)