From 348b4bc717c3b49500400fb29a134a4f89b13205 Mon Sep 17 00:00:00 2001 From: dockes Date: Tue, 26 Jun 2007 16:09:19 +0000 Subject: [PATCH] comments --- src/internfile/internfile.cpp | 16 +++++++++++----- src/internfile/internfile.h | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index 22646fc6..29e694fd 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: internfile.cpp,v 1.32 2007-06-19 12:27:52 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: internfile.cpp,v 1.33 2007-06-26 16:09:19 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -536,20 +536,26 @@ class DirWiper { } }; +// Extract subdoc out of multidoc into temporary file. +// We do the usual internfile stuff: create a temporary directory, +// then create an interner and call internfile. +// We then write the data out of the resulting document into the output file. bool FileInterner::idocTempFile(TempFile& otemp, RclConfig *cnf, const string& fn, const string& ipath, const string& mtype) { - string tmpdir, reason; - if (!maketmpdir(tmpdir, reason)) - return false; - DirWiper wiper(tmpdir); struct stat st; if (stat(fn.c_str(), &st) < 0) { LOGERR(("FileInterner::idocTempFile: can't stat [%s]\n", fn.c_str())); return false; } + + string tmpdir, reason; + if (!maketmpdir(tmpdir, reason)) + return false; + DirWiper wiper(tmpdir); + FileInterner interner(fn, &st, cnf, tmpdir, &mtype); interner.setTargetMType(mtype); Rcl::Doc doc; diff --git a/src/internfile/internfile.h b/src/internfile/internfile.h index ae73a189..4abd7860 100644 --- a/src/internfile/internfile.h +++ b/src/internfile/internfile.h @@ -16,7 +16,7 @@ */ #ifndef _INTERNFILE_H_INCLUDED_ #define _INTERNFILE_H_INCLUDED_ -/* @(#$Id: internfile.h,v 1.15 2007-06-19 12:27:52 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: internfile.h,v 1.16 2007-06-26 16:09:19 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include @@ -87,7 +87,17 @@ class FileInterner { */ void setTargetMType(const string& tp) {m_targetMType = tp;} - /** Utility function: extract internal document and make temporary file */ + /** Utility function: extract internal document into temporary file. + * This is used mainly for starting an external viewer for a + * subdocument (ie: mail attachment). + * @return true for success. + * @param temp output reference-counted temp file object (goes + * away magically) + * @param cnf The recoll config + * @param fn The main document from which to extract + * @param ipath The internal path to the subdoc + * @param mtype The target mime type (we don't want to decode to text!) + */ static bool idocTempFile(TempFile& temp, RclConfig *cnf, const string& fn, const string& ipath, const string& mtype);