|
a/src/internfile/internfile.cpp |
|
b/src/internfile/internfile.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.45 2008-10-08 16:15:22 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.46 2008-10-10 08:04:54 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
100 |
|
100 |
|
101 |
// Execute command and retrieve output file name, check that it exists
|
101 |
// Execute command and retrieve output file name, check that it exists
|
102 |
ExecCmd ex;
|
102 |
ExecCmd ex;
|
103 |
int status = ex.doexec(cmd, args, 0, &tfile);
|
103 |
int status = ex.doexec(cmd, args, 0, &tfile);
|
104 |
if (status || tfile.empty()) {
|
104 |
if (status || tfile.empty()) {
|
105 |
LOGERR(("uncompressfile: doexec: status 0x%x\n", status));
|
105 |
LOGERR(("uncompressfile: doexec: failed for [%s] status 0x%x\n", ifn.c_str(), status));
|
106 |
rmdir(tdir.c_str());
|
106 |
rmdir(tdir.c_str());
|
107 |
return false;
|
107 |
return false;
|
108 |
}
|
108 |
}
|
109 |
if (tfile[tfile.length() - 1] == '\n')
|
109 |
if (tfile[tfile.length() - 1] == '\n')
|
110 |
tfile.erase(tfile.length() - 1, 1);
|
110 |
tfile.erase(tfile.length() - 1, 1);
|
|
... |
|
... |
179 |
Dijon::Filter *df = getMimeHandler(l_mime, m_cfg, !m_forPreview);
|
179 |
Dijon::Filter *df = getMimeHandler(l_mime, m_cfg, !m_forPreview);
|
180 |
|
180 |
|
181 |
if (!df) {
|
181 |
if (!df) {
|
182 |
// No handler for this type, for now :( if indexallfilenames
|
182 |
// No handler for this type, for now :( if indexallfilenames
|
183 |
// is set in the config, this normally wont happen (we get mh_unknown)
|
183 |
// is set in the config, this normally wont happen (we get mh_unknown)
|
184 |
LOGDEB(("FileInterner:: no handler for %s\n", l_mime.c_str()));
|
184 |
LOGERR(("FileInterner:: ignored: [%s] mime [%s]\n", f.c_str(), l_mime.c_str()));
|
185 |
return;
|
185 |
return;
|
186 |
}
|
186 |
}
|
187 |
df->set_property(Dijon::Filter::OPERATING_MODE,
|
187 |
df->set_property(Dijon::Filter::OPERATING_MODE,
|
188 |
m_forPreview ? "view" : "index");
|
188 |
m_forPreview ? "view" : "index");
|
189 |
|
189 |
|
|
... |
|
... |
504 |
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath)
|
504 |
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath)
|
505 |
{
|
505 |
{
|
506 |
LOGDEB(("FileInterner::internfile. ipath [%s]\n", ipath.c_str()));
|
506 |
LOGDEB(("FileInterner::internfile. ipath [%s]\n", ipath.c_str()));
|
507 |
if (m_handlers.size() < 1) {
|
507 |
if (m_handlers.size() < 1) {
|
508 |
// Just means the constructor failed
|
508 |
// Just means the constructor failed
|
509 |
LOGERR(("FileInterner::internfile: constructor failed\n"));
|
509 |
LOGDEB(("FileInterner::internfile: no handler: constructor failed\n"));
|
510 |
return FIError;
|
510 |
return FIError;
|
511 |
}
|
511 |
}
|
512 |
|
512 |
|
513 |
// Input Ipath vector when retrieving a given subdoc for previewing
|
513 |
// Input Ipath vector when retrieving a given subdoc for previewing
|
514 |
// Note that the vector is big enough for the maximum stack. All values
|
514 |
// Note that the vector is big enough for the maximum stack. All values
|
|
... |
|
... |
581 |
}
|
581 |
}
|
582 |
}
|
582 |
}
|
583 |
breakloop:
|
583 |
breakloop:
|
584 |
|
584 |
|
585 |
if (m_handlers.empty()) {
|
585 |
if (m_handlers.empty()) {
|
586 |
LOGERR(("FileInterner::internfile: conversion ended with no doc\n"));
|
586 |
LOGDEB(("FileInterner::internfile: conversion ended with no doc\n"));
|
587 |
return FIError;
|
587 |
return FIError;
|
588 |
}
|
588 |
}
|
589 |
|
589 |
|
590 |
// If indexing compute ipath and significant mimetype.
|
590 |
// If indexing compute ipath and significant mimetype.
|
591 |
// ipath is returned through the parameter not doc.ipath We also
|
591 |
// ipath is returned through the parameter not doc.ipath We also
|
|
... |
|
... |
602 |
dijontorcl(doc);
|
602 |
dijontorcl(doc);
|
603 |
|
603 |
|
604 |
// Possibly destack so that we can test for FIDone. While doing this
|
604 |
// Possibly destack so that we can test for FIDone. While doing this
|
605 |
// possibly set aside an ancestor html text (for the GUI preview)
|
605 |
// possibly set aside an ancestor html text (for the GUI preview)
|
606 |
while (!m_handlers.empty() && !m_handlers.back()->has_documents()) {
|
606 |
while (!m_handlers.empty() && !m_handlers.back()->has_documents()) {
|
607 |
LOGDEB(("FileInterner::internfile: dstck filter fpv %d tgt %s\n",
|
|
|
608 |
m_forPreview, m_targetMType.c_str()));
|
|
|
609 |
if (m_forPreview) {
|
607 |
if (m_forPreview) {
|
610 |
LOGDEB(("FileInterner::internfile: Testing for html handler\n"));
|
|
|
611 |
MimeHandlerHtml *hth =
|
608 |
MimeHandlerHtml *hth =
|
612 |
dynamic_cast<MimeHandlerHtml*>(m_handlers.back());
|
609 |
dynamic_cast<MimeHandlerHtml*>(m_handlers.back());
|
613 |
if (hth) {
|
610 |
if (hth) {
|
614 |
m_html = hth->get_html();
|
611 |
m_html = hth->get_html();
|
615 |
}
|
612 |
}
|