|
a/src/internfile/mh_exec.cpp |
|
b/src/internfile/mh_exec.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.8 2006-12-15 12:40:02 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: mh_exec.cpp,v 1.9 2007-02-06 18:01:58 dockes Exp $ (C) 2005 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
|
|
... |
|
... |
43 |
return false;
|
43 |
return false;
|
44 |
m_havedoc = false;
|
44 |
m_havedoc = false;
|
45 |
if (params.empty()) {
|
45 |
if (params.empty()) {
|
46 |
// Hu ho
|
46 |
// Hu ho
|
47 |
LOGERR(("MimeHandlerExec::mkDoc: empty params\n"));
|
47 |
LOGERR(("MimeHandlerExec::mkDoc: empty params\n"));
|
|
|
48 |
m_reason = "RECFILTERROR BADCONFIG";
|
48 |
return false;
|
49 |
return false;
|
49 |
}
|
50 |
}
|
50 |
|
51 |
|
51 |
// Command name
|
52 |
// Command name
|
52 |
string cmd = params.front();
|
53 |
string cmd = params.front();
|
|
... |
|
... |
56 |
list<string>myparams(++it, params.end());
|
57 |
list<string>myparams(++it, params.end());
|
57 |
myparams.push_back(m_fn);
|
58 |
myparams.push_back(m_fn);
|
58 |
|
59 |
|
59 |
// Execute command and store the result text, which is supposedly html
|
60 |
// Execute command and store the result text, which is supposedly html
|
60 |
string& html = m_metaData["content"];
|
61 |
string& html = m_metaData["content"];
|
|
|
62 |
html.erase();
|
61 |
ExecCmd mexec;
|
63 |
ExecCmd mexec;
|
62 |
MEAdv adv;
|
64 |
MEAdv adv;
|
63 |
mexec.setAdvise(&adv);
|
65 |
mexec.setAdvise(&adv);
|
64 |
mexec.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
|
66 |
mexec.putenv(m_forPreview ? "RECOLL_FILTER_FORPREVIEW=yes" :
|
65 |
"RECOLL_FILTER_FORPREVIEW=no");
|
67 |
"RECOLL_FILTER_FORPREVIEW=no");
|
66 |
int status = mexec.doexec(cmd, myparams, 0, &html);
|
68 |
int status = mexec.doexec(cmd, myparams, 0, &html);
|
67 |
if (status) {
|
69 |
if (status) {
|
68 |
LOGERR(("MimeHandlerExec: command status 0x%x: %s\n",
|
70 |
LOGERR(("MimeHandlerExec: command status 0x%x: %s\n",
|
69 |
status, cmd.c_str()));
|
71 |
status, cmd.c_str()));
|
|
|
72 |
// If the output string begins with RECFILTERROR, then it's
|
|
|
73 |
// interpretable error information
|
|
|
74 |
if (html.find("RECFILTERROR") == 0)
|
|
|
75 |
m_reason = html;
|
70 |
return false;
|
76 |
return false;
|
71 |
}
|
77 |
}
|
72 |
|
78 |
|
73 |
m_metaData["origcharset"] = m_defcharset;
|
79 |
m_metaData["origcharset"] = m_defcharset;
|
74 |
// All recoll filters output utf-8
|
80 |
// All recoll filters output utf-8
|