let email attachments inherit date and author from parent message

This commit is contained in:
dockes 2007-05-22 08:33:03 +00:00
parent e04fbf3fb4
commit 8e51cf42d3
2 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.28 2007-02-19 18:05:25 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.29 2007-05-22 08:33:03 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -299,6 +299,8 @@ 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
// We also set the author and modification time from the last doc
// which has them.
void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) const
{
bool hasipath = false;
@ -322,6 +324,9 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc, string& ipath) const
} else {
ipath += isep;
}
getKeyValue(docdata, keyau, doc.author);
getKeyValue(docdata, keymd, doc.dmtime);
LOGDEB(("doc.dmtime now %s\n", doc.dmtime.c_str()));
}
// Trim empty tail elements in ipath.
@ -488,11 +493,15 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, string& ipath)
return FIError;
}
// If indexing compute ipath and significant mimetype
// Note that ipath is returned through the parameter not doc.ipath
// If indexing compute ipath and significant mimetype Note that
// ipath is returned through the parameter not doc.ipath We also
// retrieve some metadata fields from the ancesters (like date or
// author). This is useful for email attachments. The values will
// be replaced by those found by dijontorcl if any, so the order
// of calls is important.
if (!m_forPreview)
collectIpathAndMT(doc, ipath);
// Keep this AFTER collectIpathAndMT
dijontorcl(doc);
// Destack what can be

View File

@ -122,8 +122,12 @@ bool MimeHandlerHtml::next_document()
m_metaData["charset"] = "utf-8";
m_metaData["title"] = result.title;
m_metaData["keywords"] = result.keywords;
m_metaData["author"] = result.author;
m_metaData["modificationdate"] = result.dmtime;
// Avoid setting empty values which would crush ones possibly inherited
// from parent (if we're an attachment)
if (!result.author.empty())
m_metaData["author"] = result.author;
if (!result.dmtime.empty())
m_metaData["modificationdate"] = result.dmtime;
m_metaData["sample"] = result.sample;
m_metaData["mimetype"] = "text/plain";
return true;