Switch to unified view

a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp
...
...
17
 *   Free Software Foundation, Inc.,
17
 *   Free Software Foundation, Inc.,
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
 */
19
 */
20
20
21
#ifndef TEST_INTERNFILE
21
#ifndef TEST_INTERNFILE
22
#include "autoconfig.h"
22
23
23
#include <unistd.h>
24
#include <unistd.h>
24
#include <fcntl.h>
25
#include <fcntl.h>
25
#include <sys/types.h>
26
#include <sys/types.h>
26
#include <sys/stat.h>
27
#include <sys/stat.h>
...
...
130
// uncompressed temporary copy, and create the top filter for the
131
// uncompressed temporary copy, and create the top filter for the
131
// uncompressed file type.
132
// uncompressed file type.
132
//
133
//
133
// Empty handler on return says that we're in error, this will be
134
// Empty handler on return says that we're in error, this will be
134
// processed by the first call to internfile().
135
// processed by the first call to internfile().
135
FileInterner::FileInterner(const std::string &f, const struct stat *stp,
136
FileInterner::FileInterner(const string &f, const struct stat *stp,
136
               RclConfig *cnf, 
137
               RclConfig *cnf, 
137
               const string& td, const string *imime)
138
               const string& td, const string *imime)
138
    : m_cfg(cnf), m_fn(f), m_forPreview(imime?true:false), m_tdir(td)
139
    : m_cfg(cnf), m_fn(f), m_forPreview(imime?true:false), m_tdir(td)
139
{
140
{
140
    bool usfci = false;
141
    bool usfci = false;
...
...
335
static const string keytt("title");
336
static const string keytt("title");
336
337
337
bool FileInterner::dijontorcl(Rcl::Doc& doc)
338
bool FileInterner::dijontorcl(Rcl::Doc& doc)
338
{
339
{
339
    Dijon::Filter *df = m_handlers.back();
340
    Dijon::Filter *df = m_handlers.back();
341
    if (df == 0) {
342
  //??
343
  LOGERR(("FileInterner::dijontorcl: null top handler ??\n"));
344
  return false;
345
    }
340
    const std::map<std::string, std::string>& docdata = df->get_meta_data();
346
    const map<string, string>& docdata = df->get_meta_data();
341
347
342
    for (map<string,string>::const_iterator it = docdata.begin(); 
348
    for (map<string,string>::const_iterator it = docdata.begin(); 
343
     it != docdata.end(); it++) {
349
     it != docdata.end(); it++) {
344
    if (it->first == keyct) {
350
    if (it->first == keyct) {
345
        doc.text = it->second;
351
        doc.text = it->second;
...
...
355
    }
361
    }
356
    if (doc.meta[Rcl::Doc::keyabs].empty() && !doc.meta[keyds].empty()) {
362
    if (doc.meta[Rcl::Doc::keyabs].empty() && !doc.meta[keyds].empty()) {
357
    doc.meta[Rcl::Doc::keyabs] = doc.meta[keyds];
363
    doc.meta[Rcl::Doc::keyabs] = doc.meta[keyds];
358
    doc.meta.erase(keyds);
364
    doc.meta.erase(keyds);
359
    }
365
    }
366
#ifdef RCL_USE_XATTR
367
    // Finally set any data possibly coming out of the extended file attributes
368
    // these override any values from inside the file.
369
    RecollFilter *rf = dynamic_cast<RecollFilter*>(df);
370
    if (rf != 0) {
371
  const map<string, string>& ffa = rf->getFieldsFromAttrs();
372
  for (map<string,string>::const_iterator it = ffa.begin(); 
373
       it != ffa.end(); it++) {
374
      doc.meta[it->first] = it->second;
375
  }
376
    }
377
#endif //RCL_USE_XATTR
360
    return true;
378
    return true;
361
}
379
}
362
380
363
// Collect the ipath from the current path in the document tree.
381
// Collect the ipath from the current path in the document tree.
364
// While we're at it, we also set the mimetype and filename, which are special 
382
// While we're at it, we also set the mimetype and filename, which are special 
...
...
423
441
424
// Just got document from current top handler. See what type it is,
442
// Just got document from current top handler. See what type it is,
425
// and possibly add a filter/handler to the stack
443
// and possibly add a filter/handler to the stack
426
int FileInterner::addHandler()
444
int FileInterner::addHandler()
427
{
445
{
428
    const std::map<std::string, std::string>& docdata = 
446
    const map<string, string>& docdata = 
429
    m_handlers.back()->get_meta_data();
447
    m_handlers.back()->get_meta_data();
430
    string charset, mimetype;
448
    string charset, mimetype;
431
    getKeyValue(docdata, keycs, charset);
449
    getKeyValue(docdata, keycs, charset);
432
    getKeyValue(docdata, keymt, mimetype);
450
    getKeyValue(docdata, keymt, mimetype);
433
451