Switch to unified view

a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp
...
...
26
#include <errno.h>
26
#include <errno.h>
27
27
28
#include <string>
28
#include <string>
29
#include <iostream>
29
#include <iostream>
30
#include <map>
30
#include <map>
31
#ifndef NO_NAMESPACES
31
32
using namespace std;
32
using namespace std;
33
#endif /* NO_NAMESPACES */
34
33
35
#include "cstr.h"
34
#include "cstr.h"
36
#include "internfile.h"
35
#include "internfile.h"
37
#include "rcldoc.h"
36
#include "rcldoc.h"
38
#include "mimetype.h"
37
#include "mimetype.h"
...
...
548
// While we're at it, we also set the mimetype and filename,
547
// While we're at it, we also set the mimetype and filename,
549
// which are special properties: we want to get them from the topmost
548
// which are special properties: we want to get them from the topmost
550
// doc with an ipath, not the last one which is usually text/plain We
549
// doc with an ipath, not the last one which is usually text/plain We
551
// also set the author and modification time from the last doc which
550
// also set the author and modification time from the last doc which
552
// has them.
551
// has them.
552
// 
553
// The stack can contain objects with an ipath element (corresponding
554
// to actual embedded documents), and, at the top, elements without an
555
// ipath element, corresponding to format translations of the last doc.
553
//
556
//
554
// The docsize is fetched from the first element without an ipath
557
// The docsize is fetched from the first element without an ipath
555
// (first non container). If the last element directly returns
558
// (first non container). If the last element directly returns
556
// text/plain so that there is no ipath-less element, the value will
559
// text/plain so that there is no ipath-less element, the value will
557
// be set in dijontorcl(). 
560
// be set in dijontorcl(). 
...
...
577
    for (vector<RecollFilter*>::const_iterator hit = m_handlers.begin();
580
    for (vector<RecollFilter*>::const_iterator hit = m_handlers.begin();
578
     hit != m_handlers.end(); hit++) {
581
     hit != m_handlers.end(); hit++) {
579
    const map<string, string>& docdata = (*hit)->get_meta_data();
582
    const map<string, string>& docdata = (*hit)->get_meta_data();
580
    if (getKeyValue(docdata, cstr_dj_keyipath, ipathel)) {
583
    if (getKeyValue(docdata, cstr_dj_keyipath, ipathel)) {
581
        if (!ipathel.empty()) {
584
        if (!ipathel.empty()) {
582
      // We have a non-empty ipath
585
      // Non-empty ipath. This stack element is for an
586
      // actual embedded document, not a format translation.
583
        hasipath = true;
587
        hasipath = true;
584
        getKeyValue(docdata, cstr_dj_keymt, doc.mimetype);
588
        getKeyValue(docdata, cstr_dj_keymt, doc.mimetype);
585
        getKeyValue(docdata, cstr_dj_keyfn, doc.meta[Rcl::Doc::keyfn]);
589
        getKeyValue(docdata, cstr_dj_keyfn, doc.meta[Rcl::Doc::keyfn]);
586
        } else {
590
        } else {
587
        if (doc.fbytes.empty())
591
        if (doc.fbytes.empty())
...
...
591
    } else {
595
    } else {
592
        if (doc.fbytes.empty())
596
        if (doc.fbytes.empty())
593
        getKeyValue(docdata, cstr_dj_keydocsize, doc.fbytes);
597
        getKeyValue(docdata, cstr_dj_keydocsize, doc.fbytes);
594
        doc.ipath += cstr_isep;
598
        doc.ipath += cstr_isep;
595
    }
599
    }
600
        // We set the author field from the innermost doc which has
601
        // one: allows finding, e.g. an image attachment having no
602
        // metadata by a search on the sender name. Only do this for
603
        // actually embedded documents (avoid replacing values from
604
        // metacmds for the topmost one). For a topmost doc, author
605
        // will be merged by dijontorcl() later on. About same for
606
        // dmtime, but an external value will be replaced, not
607
        // augmented if dijontorcl() finds an internal value.
608
        if (hasipath) {
596
  getKeyValue(docdata, cstr_dj_keyauthor, doc.meta[Rcl::Doc::keyau]);
609
            getKeyValue(docdata, cstr_dj_keyauthor, doc.meta[Rcl::Doc::keyau]);
597
  getKeyValue(docdata, cstr_dj_keymd, doc.dmtime);
610
            getKeyValue(docdata, cstr_dj_keymd, doc.dmtime);
611
        }
598
    }
612
    }
599
613
600
    // Trim empty tail elements in ipath.
614
    // Trim empty tail elements in ipath.
601
    if (hasipath) {
615
    if (hasipath) {
602
    LOGDEB2(("IPATH [%s]\n", doc.ipath.c_str()));
616
    LOGDEB2(("IPATH [%s]\n", doc.ipath.c_str()));
...
...
874
    }
888
    }
875
    if (m_handlers.empty())
889
    if (m_handlers.empty())
876
    return FIDone;
890
    return FIDone;
877
    else 
891
    else 
878
    return FIAgain;
892
    return FIAgain;
879
}
880
881
// Temporary while we fix backend things
882
static string urltolocalpath(string url)
883
{
884
    return url.substr(7, string::npos);
885
}
893
}
886
894
887
bool FileInterner::tempFileForMT(TempFile& otemp, RclConfig* cnf, 
895
bool FileInterner::tempFileForMT(TempFile& otemp, RclConfig* cnf, 
888
                                 const string& mimetype)
896
                                 const string& mimetype)
889
{
897
{