Switch to unified view

a/src/internfile/mh_mail.cpp b/src/internfile/mh_mail.cpp
...
...
36
#include "debuglog.h"
36
#include "debuglog.h"
37
#include "smallut.h"
37
#include "smallut.h"
38
#include "mh_html.h"
38
#include "mh_html.h"
39
#include "rclconfig.h"
39
#include "rclconfig.h"
40
#include "mimetype.h"
40
#include "mimetype.h"
41
#include "md5.h"
41
42
42
// binc imap mime definitions
43
// binc imap mime definitions
43
#include "mime.h"
44
#include "mime.h"
44
45
45
using namespace std;
46
using namespace std;
...
...
79
    LOGDEB(("MimeHandlerMail::set_document_file(%s)\n", fn.c_str()));
80
    LOGDEB(("MimeHandlerMail::set_document_file(%s)\n", fn.c_str()));
80
    if (m_fd >= 0) {
81
    if (m_fd >= 0) {
81
    close(m_fd);
82
    close(m_fd);
82
    m_fd = -1;
83
    m_fd = -1;
83
    }
84
    }
85
86
    // Yes, we read the file twice. It would be possible in theory to add
87
    // the md5 computation to the mime analysis, but ...
88
    string md5, xmd5, reason;
89
    if (MD5File(fn, md5, &reason)) {
90
  m_metaData["md5"] = MD5HexPrint(md5, xmd5);
91
    } else {
92
  LOGERR(("MimeHandlerMail: cant compute md5 for [%s]: %s\n", fn.c_str(),
93
      reason.c_str()));
94
    }
95
96
84
    m_fd = open(fn.c_str(), 0);
97
    m_fd = open(fn.c_str(), 0);
85
    if (m_fd < 0) {
98
    if (m_fd < 0) {
86
    LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
99
    LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
87
        fn.c_str(), errno));
100
        fn.c_str(), errno));
88
    return false;
101
    return false;
...
...
102
bool MimeHandlerMail::set_document_string(const string &msgtxt)
115
bool MimeHandlerMail::set_document_string(const string &msgtxt)
103
{
116
{
104
    LOGDEB1(("MimeHandlerMail::set_document_string\n"));
117
    LOGDEB1(("MimeHandlerMail::set_document_string\n"));
105
    LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
118
    LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
106
    delete m_stream;
119
    delete m_stream;
120
121
    string md5, xmd5;
122
    MD5String(msgtxt, md5);
123
    m_metaData["md5"] = MD5HexPrint(md5, xmd5);
124
107
    m_stream = new stringstream(msgtxt);
125
    m_stream = new stringstream(msgtxt);
108
    delete m_bincdoc;
126
    delete m_bincdoc;
109
    m_bincdoc = new Binc::MimeDocument;
127
    m_bincdoc = new Binc::MimeDocument;
110
    m_bincdoc->parseFull(*m_stream);
128
    m_bincdoc->parseFull(*m_stream);
111
    if (!m_bincdoc->isHeaderParsed() && !m_bincdoc->isAllParsed()) {
129
    if (!m_bincdoc->isHeaderParsed() && !m_bincdoc->isAllParsed()) {