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) 
58
MimeHandlerMail::MimeHandlerMail(RclConfig *cnf, const string &mt) 
59
    : RecollFilter(mt), m_bincdoc(0), m_fd(-1), m_stream(0), m_idx(-1)
59
    : RecollFilter(cnf, mt), m_bincdoc(0), m_fd(-1), m_stream(0), m_idx(-1)
60
{
60
{
61
61
62
    // Look for additional headers to be processed as per config:
62
    // Look for additional headers to be processed as per config:
63
    list<string> hdrnames = 
63
    list<string> hdrnames = 
64
        RclConfig::getMainConfig()->getFieldSectNames("mail");
64
        m_config->getFieldSectNames("mail");
65
    if (hdrnames.empty())
65
    if (hdrnames.empty())
66
        return;
66
        return;
67
    for (list<string>::const_iterator it = hdrnames.begin();
67
    for (list<string>::const_iterator it = hdrnames.begin();
68
         it != hdrnames.end(); it++) {
68
         it != hdrnames.end(); it++) {
69
        (void)RclConfig::getMainConfig()->
70
            getFieldConfParam(*it, "mail", m_addProcdHdrs[*it]);
69
        (void)m_config->getFieldConfParam(*it, "mail", m_addProcdHdrs[*it]);
71
    }
70
    }
72
}
71
}
73
72
74
MimeHandlerMail::~MimeHandlerMail() 
73
MimeHandlerMail::~MimeHandlerMail() 
75
{
74
{
...
...
280
    // Special case for application/octet-stream: try to better
279
    // Special case for application/octet-stream: try to better
281
    // identify content, using file name if set
280
    // identify content, using file name if set
282
    if (m_metaData[cstr_mimetype] == "application/octet-stream" &&
281
    if (m_metaData[cstr_mimetype] == "application/octet-stream" &&
283
    !m_metaData["filename"].empty()) {
282
    !m_metaData["filename"].empty()) {
284
    string mt = mimetype(m_metaData["filename"], 0, 
283
    string mt = mimetype(m_metaData["filename"], 0, 
285
               RclConfig::getMainConfig(), false);
284
               m_config, false);
286
    if (!mt.empty()) 
285
    if (!mt.empty()) 
287
        m_metaData[cstr_mimetype] = mt;
286
        m_metaData[cstr_mimetype] = mt;
288
    }
287
    }
289
288
290
    // Ipath
289
    // Ipath
...
...
530
    !stringlowercmp("us-ascii", charset) || 
529
    !stringlowercmp("us-ascii", charset) || 
531
    !stringlowercmp("default", charset) || 
530
    !stringlowercmp("default", charset) || 
532
    !stringlowercmp("x-user-defined", charset) || 
531
    !stringlowercmp("x-user-defined", charset) || 
533
    !stringlowercmp("x-unknown", charset) || 
532
    !stringlowercmp("x-unknown", charset) || 
534
    !stringlowercmp("unknown", charset) ) {
533
    !stringlowercmp("unknown", charset) ) {
535
        RclConfig::getMainConfig()->getConfParam("maildefcharset", charset);
534
        m_config->getConfParam("maildefcharset", charset);
536
        if (charset.empty())
535
        if (charset.empty())
537
            charset = "iso-8859-1";
536
            charset = "iso-8859-1";
538
    }
537
    }
539
538
540
    // Content transfer encoding
539
    // Content transfer encoding
...
...
596
595
597
    // Handle html stripping and transcoding to utf8
596
    // Handle html stripping and transcoding to utf8
598
    string utf8;
597
    string utf8;
599
    const string *putf8 = 0;
598
    const string *putf8 = 0;
600
    if (!stringlowercmp("text/html", content_type.value)) {
599
    if (!stringlowercmp("text/html", content_type.value)) {
601
    MimeHandlerHtml mh("text/html");
600
    MimeHandlerHtml mh(m_config, "text/html");
602
    mh.set_property(Dijon::Filter::OPERATING_MODE, 
601
    mh.set_property(Dijon::Filter::OPERATING_MODE, 
603
            m_forPreview ? "view" : "index");
602
            m_forPreview ? "view" : "index");
604
    mh.set_property(Dijon::Filter::DEFAULT_CHARSET, charset);
603
    mh.set_property(Dijon::Filter::DEFAULT_CHARSET, charset);
605
    mh.set_document_string(body);
604
    mh.set_document_string(body);
606
    mh.next_document();
605
    mh.next_document();