From e413df178602a42590cf122a3555e9f125b0ddd8 Mon Sep 17 00:00:00 2001 From: dockes Date: Mon, 15 Jan 2007 13:06:57 +0000 Subject: [PATCH] dont stop processing a complex document on the first next_document error: pop level and go on --- src/internfile/internfile.cpp | 17 +++++++++++++---- src/internfile/internfile.h | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index 406f5bc6..4318ac08 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.23 2006-12-20 14:28:35 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: internfile.cpp,v 1.24 2007-01-15 13:06:38 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -266,7 +266,7 @@ bool FileInterner::dijontorcl(Rcl::Doc& doc) // While we're at it, we also set the mimetype and filename, which are special // properties: we want to get them from the topmost doc // with an ipath, not the last one which is usually text/plain -void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) +void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) const { bool hasipath = false; @@ -307,6 +307,8 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) // Remove handler from stack. Clean up temp file if needed. void FileInterner::popHandler() { + if (m_handlers.empty()) + return; int i = m_handlers.size()-1; if (m_tmpflgs[i]) { m_tempfiles.pop_back(); @@ -357,9 +359,16 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath) continue; } + // Don't stop on next_document() error. There might be ie an + // error while decoding an attachment, but we still want to + // process the rest of the mbox! if (!m_handlers.back()->next_document()) { - LOGERR(("FileInterner::internfile: next_document failed\n")); - return FIError; + Rcl::Doc doc; string ipath; + collectIpathAndMT(doc, ipath); + LOGERR(("FileInterner::internfile: next_document error [%s%s%s]\n", + m_fn.c_str(), ipath.empty()?"":"|", ipath.c_str())); + popHandler(); + continue; } // Look at what we've got diff --git a/src/internfile/internfile.h b/src/internfile/internfile.h index e3139323..d7ca8b1d 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.10 2006-12-19 08:40:50 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: internfile.h,v 1.11 2007-01-15 13:06:38 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include @@ -106,7 +106,7 @@ class FileInterner { void tmpcleanup(); bool dijontorcl(Rcl::Doc&); - void collectIpathAndMT(Rcl::Doc&, string& ipath); + void collectIpathAndMT(Rcl::Doc&, string& ipath) const; bool dataToTempFile(const string& data, const string& mt, string& fn); void popHandler(); };