Switch to unified view

a/src/internfile/mh_mail.cpp b/src/internfile/mh_mail.cpp
...
...
53
static const string cstr_modificationdate = "modificationdate";
53
static const string cstr_modificationdate = "modificationdate";
54
static const string cstr_title = "title";
54
static const string cstr_title = "title";
55
static const string cstr_msgid = "msgid";
55
static const string cstr_msgid = "msgid";
56
static const string cstr_abstract = "abstract";
56
static const string cstr_abstract = "abstract";
57
57
58
MimeHandlerMail::MimeHandlerMail(const string &mt) 
59
    : RecollFilter(mt), m_bincdoc(0), m_fd(-1), m_stream(0), m_idx(-1)
60
{
61
62
    // Look for additional headers to be processed as per config:
63
    list<string> hdrnames = 
64
        RclConfig::getMainConfig()->getFieldSectNames("mail");
65
    if (hdrnames.empty())
66
        return;
67
    for (list<string>::const_iterator it = hdrnames.begin();
68
         it != hdrnames.end(); it++) {
69
        (void)RclConfig::getMainConfig()->
70
            getFieldConfParam(*it, "mail", m_addProcdHdrs[*it]);
71
    }
72
}
73
58
MimeHandlerMail::~MimeHandlerMail() 
74
MimeHandlerMail::~MimeHandlerMail() 
59
{
75
{
60
    clear();
76
    clear();
61
}
77
}
62
void MimeHandlerMail::clear()
78
void MimeHandlerMail::clear()
...
...
93
    m_metaData["md5"] = MD5HexPrint(md5, xmd5);
109
    m_metaData["md5"] = MD5HexPrint(md5, xmd5);
94
    } else {
110
    } else {
95
    LOGERR(("MimeHandlerMail: cant compute md5 for [%s]: %s\n", fn.c_str(),
111
    LOGERR(("MimeHandlerMail: cant compute md5 for [%s]: %s\n", fn.c_str(),
96
        reason.c_str()));
112
        reason.c_str()));
97
    }
113
    }
98
99
114
100
    m_fd = open(fn.c_str(), 0);
115
    m_fd = open(fn.c_str(), 0);
101
    if (m_fd < 0) {
116
    if (m_fd < 0) {
102
    LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
117
    LOGERR(("MimeHandlerMail::set_document_file: open(%s) errno %d\n",
103
        fn.c_str(), errno));
118
        fn.c_str(), errno));
...
...
350
        m_metaData[cstr_title] = transcoded;
365
        m_metaData[cstr_title] = transcoded;
351
        m_subject = transcoded;
366
        m_subject = transcoded;
352
    }
367
    }
353
    text += string("Subject: ") + transcoded + string("\n");
368
    text += string("Subject: ") + transcoded + string("\n");
354
    }
369
    }
370
371
    // Check for the presence of configured additional headers and possibly
372
    // add them to the metadata (with appropriate field name).
373
    if (!m_addProcdHdrs.empty()) {
374
        for (map<string, string>::const_iterator it = m_addProcdHdrs.begin();
375
             it != m_addProcdHdrs.end(); it++) {
376
            if (!it->second.empty()) {
377
                string hval;
378
                if (doc->h.getFirstHeader(it->first, hi)) {
379
                    m_metaData[it->second] = hi.getValue();
380
                }
381
            }
382
        }
383
    }
384
355
    text += '\n';
385
    text += '\n';
356
    m_startoftext = text.size();
386
    m_startoftext = text.size();
357
    LOGDEB2(("MimeHandlerMail::processMsg:ismultipart %d mime subtype '%s'\n",
387
    LOGDEB2(("MimeHandlerMail::processMsg:ismultipart %d mime subtype '%s'\n",
358
        doc->isMultipart(), doc->getSubType().c_str()));
388
        doc->isMultipart(), doc->getSubType().c_str()));
359
    walkmime(doc, depth);
389
    walkmime(doc, depth);