|
a/src/internfile/mh_mail.cpp |
|
b/src/internfile/mh_mail.cpp |
|
... |
|
... |
50 |
static const string cstr_modificationdate = "modificationdate";
|
50 |
static const string cstr_modificationdate = "modificationdate";
|
51 |
static const string cstr_title = "title";
|
51 |
static const string cstr_title = "title";
|
52 |
static const string cstr_msgid = "msgid";
|
52 |
static const string cstr_msgid = "msgid";
|
53 |
static const string cstr_abstract = "abstract";
|
53 |
static const string cstr_abstract = "abstract";
|
54 |
|
54 |
|
|
|
55 |
static const string cstr_newline = "\n";
|
|
|
56 |
|
55 |
MimeHandlerMail::MimeHandlerMail(RclConfig *cnf, const string &mt)
|
57 |
MimeHandlerMail::MimeHandlerMail(RclConfig *cnf, const string &mt)
|
56 |
: RecollFilter(cnf, mt), m_bincdoc(0), m_fd(-1), m_stream(0), m_idx(-1)
|
58 |
: RecollFilter(cnf, mt), m_bincdoc(0), m_fd(-1), m_stream(0), m_idx(-1)
|
57 |
{
|
59 |
{
|
58 |
|
60 |
|
59 |
// Look for additional headers to be processed as per config:
|
61 |
// Look for additional headers to be processed as per config:
|
|
... |
|
... |
313 |
string& text = m_metaData[cstr_content];
|
315 |
string& text = m_metaData[cstr_content];
|
314 |
Binc::HeaderItem hi;
|
316 |
Binc::HeaderItem hi;
|
315 |
string transcoded;
|
317 |
string transcoded;
|
316 |
if (doc->h.getFirstHeader("From", hi)) {
|
318 |
if (doc->h.getFirstHeader("From", hi)) {
|
317 |
rfc2047_decode(hi.getValue(), transcoded);
|
319 |
rfc2047_decode(hi.getValue(), transcoded);
|
318 |
text += string("From: ") + transcoded + string("\n");
|
320 |
if (preview())
|
|
|
321 |
text += string("From: ");
|
|
|
322 |
text += transcoded + cstr_newline;
|
319 |
if (depth == 1) {
|
323 |
if (depth == 1) {
|
320 |
m_metaData[cstr_author] = transcoded;
|
324 |
m_metaData[cstr_author] = transcoded;
|
321 |
}
|
325 |
}
|
322 |
}
|
326 |
}
|
323 |
if (doc->h.getFirstHeader("To", hi)) {
|
327 |
if (doc->h.getFirstHeader("To", hi)) {
|
324 |
rfc2047_decode(hi.getValue(), transcoded);
|
328 |
rfc2047_decode(hi.getValue(), transcoded);
|
325 |
text += string("To: ") + transcoded + string("\n");
|
329 |
if (preview())
|
|
|
330 |
text += string("To: ");
|
|
|
331 |
text += transcoded + cstr_newline;
|
326 |
if (depth == 1) {
|
332 |
if (depth == 1) {
|
327 |
m_metaData[cstr_recipient] = transcoded;
|
333 |
m_metaData[cstr_recipient] = transcoded;
|
328 |
}
|
334 |
}
|
329 |
}
|
335 |
}
|
330 |
if (doc->h.getFirstHeader("Cc", hi)) {
|
336 |
if (doc->h.getFirstHeader("Cc", hi)) {
|
331 |
rfc2047_decode(hi.getValue(), transcoded);
|
337 |
rfc2047_decode(hi.getValue(), transcoded);
|
332 |
text += string("Cc: ") + transcoded + string("\n");
|
338 |
if (preview())
|
|
|
339 |
text += string("Cc: ");
|
|
|
340 |
text += transcoded + cstr_newline;
|
333 |
if (depth == 1) {
|
341 |
if (depth == 1) {
|
334 |
m_metaData[cstr_recipient] += " " + transcoded;
|
342 |
m_metaData[cstr_recipient] += " " + transcoded;
|
335 |
}
|
343 |
}
|
336 |
}
|
344 |
}
|
337 |
if (doc->h.getFirstHeader("Message-Id", hi)) {
|
345 |
if (doc->h.getFirstHeader("Message-Id", hi)) {
|
|
... |
|
... |
351 |
} else {
|
359 |
} else {
|
352 |
// Leave mtime field alone, ftime will be used instead.
|
360 |
// Leave mtime field alone, ftime will be used instead.
|
353 |
LOGDEB(("rfc2822Date...: failed: [%s]\n", transcoded.c_str()));
|
361 |
LOGDEB(("rfc2822Date...: failed: [%s]\n", transcoded.c_str()));
|
354 |
}
|
362 |
}
|
355 |
}
|
363 |
}
|
356 |
text += string("Date: ") + transcoded + string("\n");
|
364 |
if (preview())
|
|
|
365 |
text += string("Date: ");
|
|
|
366 |
text += transcoded + cstr_newline;
|
357 |
}
|
367 |
}
|
358 |
if (doc->h.getFirstHeader("Subject", hi)) {
|
368 |
if (doc->h.getFirstHeader("Subject", hi)) {
|
359 |
rfc2047_decode(hi.getValue(), transcoded);
|
369 |
rfc2047_decode(hi.getValue(), transcoded);
|
360 |
if (depth == 1) {
|
370 |
if (depth == 1) {
|
361 |
m_metaData[cstr_title] = transcoded;
|
371 |
m_metaData[cstr_title] = transcoded;
|
362 |
m_subject = transcoded;
|
372 |
m_subject = transcoded;
|
363 |
}
|
373 |
}
|
364 |
text += string("Subject: ") + transcoded + string("\n");
|
374 |
if (preview())
|
|
|
375 |
text += string("Subject: ");
|
|
|
376 |
text += transcoded + cstr_newline;
|
365 |
}
|
377 |
}
|
366 |
|
378 |
|
367 |
// Check for the presence of configured additional headers and possibly
|
379 |
// Check for the presence of configured additional headers and possibly
|
368 |
// add them to the metadata (with appropriate field name).
|
380 |
// add them to the metadata (with appropriate field name).
|
369 |
if (!m_addProcdHdrs.empty()) {
|
381 |
if (!m_addProcdHdrs.empty()) {
|