get all mime list from mimeconf, not mimemap
This commit is contained in:
parent
4821854e08
commit
cc0c72748e
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.13 2005-11-24 07:16:15 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.14 2005-11-25 09:13:06 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -101,39 +101,27 @@ bool RclConfig::getConfParam(const std::string &name, int *ivp)
|
|||||||
|
|
||||||
bool RclConfig::getConfParam(const std::string &name, bool *bvp)
|
bool RclConfig::getConfParam(const std::string &name, bool *bvp)
|
||||||
{
|
{
|
||||||
|
if (!bvp)
|
||||||
|
return false;
|
||||||
|
|
||||||
*bvp = false;
|
*bvp = false;
|
||||||
string s;
|
string s;
|
||||||
if (!getConfParam(name, s))
|
if (!getConfParam(name, s))
|
||||||
return false;
|
return false;
|
||||||
if (s.empty())
|
*bvp = stringToBool(s);
|
||||||
return true;
|
|
||||||
if (isdigit(s[0])) {
|
|
||||||
int val = atoi(s.c_str());
|
|
||||||
*bvp = val ? true : false;
|
|
||||||
} else if (strchr("yYoOtT", s[0])) {
|
|
||||||
*bvp = true;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConfSimple::WalkerCode mtypesWalker(void *l,
|
// Get all known document mime values. We get them from the mimeconf
|
||||||
const char *nm, const char *value)
|
// 'index' submap: values not in there (ie from mimemap or idfile) can't
|
||||||
{
|
// possibly belong to documents in the database.
|
||||||
std::list<string> *lst = (std::list<string> *)l;
|
|
||||||
if (nm && nm[0] == '.')
|
|
||||||
lst->push_back(value);
|
|
||||||
return ConfSimple::WALK_CONTINUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "idfile.h"
|
|
||||||
std::list<string> RclConfig::getAllMimeTypes()
|
std::list<string> RclConfig::getAllMimeTypes()
|
||||||
{
|
{
|
||||||
std::list<string> lst;
|
std::list<string> lst;
|
||||||
if (mimemap == 0)
|
if (mimeconf == 0)
|
||||||
return lst;
|
return lst;
|
||||||
mimemap->sortwalk(mtypesWalker, &lst);
|
// mimeconf->sortwalk(mtypesWalker, &lst);
|
||||||
std::list<string> l1 = idFileAllTypes();
|
lst = mimeconf->getNames("index");
|
||||||
lst.insert(lst.end(), l1.begin(), l1.end());
|
|
||||||
lst.sort();
|
lst.sort();
|
||||||
lst.unique();
|
lst.unique();
|
||||||
return lst;
|
return lst;
|
||||||
@ -144,7 +132,7 @@ bool RclConfig::getStopSuffixes(list<string>& sufflist)
|
|||||||
if (stopsuffixes == 0 && (stopsuffixes = new list<string>) != 0) {
|
if (stopsuffixes == 0 && (stopsuffixes = new list<string>) != 0) {
|
||||||
string stp;
|
string stp;
|
||||||
if (mimemap->get("recoll_noindex", stp, keydir)) {
|
if (mimemap->get("recoll_noindex", stp, keydir)) {
|
||||||
ConfTree::stringToStrings(stp, *stopsuffixes);
|
stringToStrings(stp, *stopsuffixes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +212,7 @@ bool RclConfig::getUncompressor(const string &mtype, list<string>& cmd)
|
|||||||
if (hs.empty())
|
if (hs.empty())
|
||||||
return false;
|
return false;
|
||||||
list<string> tokens;
|
list<string> tokens;
|
||||||
ConfTree::stringToStrings(hs, tokens);
|
stringToStrings(hs, tokens);
|
||||||
if (tokens.empty()) {
|
if (tokens.empty()) {
|
||||||
LOGERR(("getUncompressor: empty spec for mtype %s\n", mtype.c_str()));
|
LOGERR(("getUncompressor: empty spec for mtype %s\n", mtype.c_str()));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
#ifndef _RCLCONFIG_H_INCLUDED_
|
#ifndef _RCLCONFIG_H_INCLUDED_
|
||||||
#define _RCLCONFIG_H_INCLUDED_
|
#define _RCLCONFIG_H_INCLUDED_
|
||||||
/* @(#$Id: rclconfig.h,v 1.8 2005-11-21 14:31:24 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: rclconfig.h,v 1.9 2005-11-25 09:13:07 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "conftree.h"
|
#include "conftree.h"
|
||||||
|
#include "smallut.h"
|
||||||
|
|
||||||
class RclConfig {
|
class RclConfig {
|
||||||
public:
|
public:
|
||||||
@ -39,7 +40,7 @@ class RclConfig {
|
|||||||
conf->get("defaultlanguage", deflang, keydir);
|
conf->get("defaultlanguage", deflang, keydir);
|
||||||
string str;
|
string str;
|
||||||
conf->get("guesscharset", str, keydir);
|
conf->get("guesscharset", str, keydir);
|
||||||
guesscharset = ConfTree::stringToBool(str);
|
guesscharset = stringToBool(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user