added the possibility to extract arbitrary mail headers and use them as document fields. This forced an incompatible change in the format of the [stored] section inside the "fields" config file

This commit is contained in:
Jean-Francois Dockes
2010-07-06 17:16:36 +02:00
parent 1b8ce2fc72
commit e6d5f72886
6 changed files with 181 additions and 32 deletions
+20 -4
View File
@@ -590,10 +590,8 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc)
}
#endif
string ss;
if (m_fields->get("stored", ss, "stored")) {
list<string> sl;
stringToStrings(ss, sl);
list<string> sl = m_fields->getNames("stored");
if (!sl.empty()) {
for (list<string>::const_iterator it = sl.begin();
it != sl.end(); it++) {
string fld = fieldCanon(stringtolower(*it));
@@ -635,6 +633,8 @@ bool RclConfig::getFieldPrefix(const string& _fld, string &pfx)
bool RclConfig::getFieldSpecialisations(const string& fld,
list<string>& children, bool top)
{
if (m_fields == 0)
return false;
string sclds;
children.push_back(fld);
if (m_fields->get(fld, sclds, "specialisations")) {
@@ -682,6 +682,22 @@ string RclConfig::fieldCanon(const string& f)
return fld;
}
list<string> RclConfig::getFieldSectNames(const string &sk, const char* patrn)
{
if (m_fields == 0)
return list<string>();
return m_fields->getNames(sk, patrn);
}
bool RclConfig::getFieldConfParam(const string &name, const string &sk,
string &value)
{
if (m_fields == 0)
return false;
return m_fields->get(name, value, sk);
}
string RclConfig::getMimeViewerDef(const string &mtype, const string& apptag)
{
LOGDEB(("RclConfig::getMimeViewerDef: mtype %s apptag %s\n",
+6 -1
View File
@@ -195,7 +195,12 @@ class RclConfig {
string fieldCanon(const string& fld);
/** Get xattr name to field names translations */
const map<string, string>& getXattrToField() {return m_xattrtofld;}
/** Get value of a parameter inside the "fields" file. Only some filters
use this (ie: mh_mail). The information specific to a given filter
is typically stored in a separate section(ie: [mail]) */
list<string> getFieldSectNames(const string &sk, const char* = 0);
bool getFieldConfParam(const string &name, const string &sk, string &value);
/** mimeview: get/set external viewer exec string(s) for mimetype(s) */
string getMimeViewerDef(const string &mimetype, const string& apptag);
bool getMimeViewerDefs(vector<pair<string, string> >&);