adapt kio and recollq to the new internfile interface

This commit is contained in:
dockes
2010-01-06 13:29:37 +00:00
parent 8bc35e8e96
commit 9f00432fb7
3 changed files with 14 additions and 29 deletions
+8 -12
View File
@@ -43,14 +43,8 @@ using namespace std;
#include "wipedir.h"
#include "transcode.h"
bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& doc)
bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& idoc)
{
string fn = doc.url.substr(7);
struct stat st;
if (stat(fn.c_str(), &st) != 0) {
cout << "No such file: " << fn << endl;
return true;
}
if (tmpdir.empty() || access(tmpdir.c_str(), 0) < 0) {
string reason;
if (!maketmpdir(tmpdir, reason)) {
@@ -60,12 +54,14 @@ bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& doc)
}
}
wipedir(tmpdir);
FileInterner interner(fn, &st, rclconfig, tmpdir,
FileInterner::FIF_forPreview, &doc.mimetype);
if (interner.internfile(doc, doc.ipath)) {
cout << doc.text << endl;
FileInterner interner(idoc, rclconfig, tmpdir,
FileInterner::FIF_forPreview);
Rcl::Doc fdoc;
string ipath = idoc.ipath;
if (interner.internfile(fdoc, ipath)) {
cout << fdoc.text << endl;
} else {
cout << "Cant intern: " << fn << endl;
cout << "Cant turn to text:" << idoc.url << " | " << idoc.ipath << endl;
}
return true;
}
+1
View File
@@ -17,6 +17,7 @@ static char rcsid[] = "@(#$Id: xadump.cpp,v 1.20 2008-12-18 14:11:01 dockes Exp
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <strings.h>