|
a/src/internfile/mh_mail.cpp |
|
b/src/internfile/mh_mail.cpp |
|
... |
|
... |
92 |
if (m_fd >= 0) {
|
92 |
if (m_fd >= 0) {
|
93 |
close(m_fd);
|
93 |
close(m_fd);
|
94 |
m_fd = -1;
|
94 |
m_fd = -1;
|
95 |
}
|
95 |
}
|
96 |
|
96 |
|
|
|
97 |
if (!m_forPreview) {
|
97 |
// Yes, we read the file twice. It would be possible in theory to add
|
98 |
// Yes, we read the file twice. It would be possible in theory
|
98 |
// the md5 computation to the mime analysis, but ...
|
99 |
// to add the md5 computation to the mime analysis, but ...
|
99 |
string md5, xmd5, reason;
|
100 |
string md5, xmd5, reason;
|
100 |
if (MD5File(fn, md5, &reason)) {
|
101 |
if (MD5File(fn, md5, &reason)) {
|
101 |
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
|
102 |
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
|
102 |
} else {
|
103 |
} else {
|
103 |
LOGERR(("MimeHandlerMail: cant compute md5 for [%s]: %s\n", fn.c_str(),
|
104 |
LOGERR(("MimeHandlerMail: cant md5 [%s]: %s\n", fn.c_str(),
|
104 |
reason.c_str()));
|
105 |
reason.c_str()));
|
|
|
106 |
}
|
105 |
}
|
107 |
}
|
106 |
|
|
|
107 |
m_fd = open(fn.c_str(), 0);
|
108 |
m_fd = open(fn.c_str(), 0);
|
108 |
if (m_fd < 0) {
|
109 |
if (m_fd < 0) {
|
109 |
LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
|
110 |
LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
|
110 |
fn.c_str(), errno));
|
111 |
fn.c_str(), errno));
|
111 |
return false;
|
112 |
return false;
|
|
... |
|
... |
126 |
{
|
127 |
{
|
127 |
LOGDEB1(("MimeHandlerMail::set_document_string\n"));
|
128 |
LOGDEB1(("MimeHandlerMail::set_document_string\n"));
|
128 |
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
|
129 |
LOGDEB2(("Message text: [%s]\n", msgtxt.c_str()));
|
129 |
delete m_stream;
|
130 |
delete m_stream;
|
130 |
|
131 |
|
|
|
132 |
if (!m_forPreview) {
|
131 |
string md5, xmd5;
|
133 |
string md5, xmd5;
|
132 |
MD5String(msgtxt, md5);
|
134 |
MD5String(msgtxt, md5);
|
133 |
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
|
135 |
m_metaData[cstr_dj_keymd5] = MD5HexPrint(md5, xmd5);
|
|
|
136 |
}
|
134 |
|
137 |
|
135 |
if ((m_stream = new stringstream(msgtxt)) == 0 || !m_stream->good()) {
|
138 |
if ((m_stream = new stringstream(msgtxt)) == 0 || !m_stream->good()) {
|
136 |
LOGERR(("MimeHandlerMail::set_document_string: stream create error."
|
139 |
LOGERR(("MimeHandlerMail::set_document_string: stream create error."
|
137 |
"msgtxt.size() %d\n", int(msgtxt.size())));
|
140 |
"msgtxt.size() %d\n", int(msgtxt.size())));
|
138 |
return false;
|
141 |
return false;
|