|
a/src/common/rclconfig.cpp |
|
b/src/common/rclconfig.cpp |
|
... |
|
... |
83 |
}
|
83 |
}
|
84 |
}
|
84 |
}
|
85 |
return false;
|
85 |
return false;
|
86 |
}
|
86 |
}
|
87 |
|
87 |
|
88 |
void ParamStale::init(RclConfig *rconf, ConfNull *cnf, const string& nm)
|
88 |
void ParamStale::init(ConfNull *cnf)
|
89 |
{
|
89 |
{
|
90 |
parent = rconf;
|
|
|
91 |
conffile = cnf;
|
90 |
conffile = cnf;
|
92 |
paramname = nm;
|
|
|
93 |
active = false;
|
91 |
active = false;
|
94 |
if (conffile)
|
92 |
if (conffile)
|
95 |
active = conffile->hasNameAnywhere(nm);
|
93 |
active = conffile->hasNameAnywhere(paramname);
|
96 |
savedkeydirgen = -1;
|
94 |
savedkeydirgen = -1;
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
ParamStale::ParamStale(RclConfig *rconf, const string& nm)
|
|
|
98 |
: parent(rconf), conffile(0), paramname(nm),
|
|
|
99 |
active(false), savedkeydirgen(-1)
|
|
|
100 |
{
|
97 |
}
|
101 |
}
|
98 |
|
102 |
|
99 |
void RclConfig::zeroMe() {
|
103 |
void RclConfig::zeroMe() {
|
100 |
m_ok = false;
|
104 |
m_ok = false;
|
101 |
m_keydirgen = 0;
|
105 |
m_keydirgen = 0;
|
|
... |
|
... |
105 |
mimeview = 0;
|
109 |
mimeview = 0;
|
106 |
m_fields = 0;
|
110 |
m_fields = 0;
|
107 |
m_ptrans = 0;
|
111 |
m_ptrans = 0;
|
108 |
m_stopsuffixes = 0;
|
112 |
m_stopsuffixes = 0;
|
109 |
m_maxsufflen = 0;
|
113 |
m_maxsufflen = 0;
|
110 |
m_stpsuffstate.init(this, 0, "recoll_noindex");
|
114 |
|
111 |
m_skpnstate.init(this, 0, "skippedNames");
|
115 |
m_stpsuffstate.init(0);
|
112 |
m_rmtstate.init(this, 0, "indexedmimetypes");
|
116 |
m_skpnstate.init(0);
|
113 |
m_mdrstate.init(this, 0, "metadatacmds");
|
117 |
m_rmtstate.init(0);
|
|
|
118 |
m_xmtstate.init(0);
|
|
|
119 |
m_mdrstate.init(0);
|
114 |
}
|
120 |
}
|
115 |
|
121 |
|
116 |
bool RclConfig::isDefaultConfig() const
|
122 |
bool RclConfig::isDefaultConfig() const
|
117 |
{
|
123 |
{
|
118 |
string defaultconf = path_cat(path_canon(path_home()), ".recoll/");
|
124 |
string defaultconf = path_cat(path_canon(path_home()), ".recoll/");
|
|
... |
|
... |
120 |
path_catslash(specifiedconf);
|
126 |
path_catslash(specifiedconf);
|
121 |
return !defaultconf.compare(specifiedconf);
|
127 |
return !defaultconf.compare(specifiedconf);
|
122 |
}
|
128 |
}
|
123 |
|
129 |
|
124 |
RclConfig::RclConfig(const string *argcnf)
|
130 |
RclConfig::RclConfig(const string *argcnf)
|
|
|
131 |
: m_stpsuffstate(this, "recoll_noindex"),
|
|
|
132 |
m_skpnstate(this, "skippedNames"),
|
|
|
133 |
m_rmtstate(this, "indexedmimetypes"),
|
|
|
134 |
m_xmtstate(this, "excludedmimetypes"),
|
|
|
135 |
m_mdrstate(this, "metadatacmds")
|
125 |
{
|
136 |
{
|
126 |
zeroMe();
|
137 |
zeroMe();
|
127 |
|
138 |
|
128 |
if (o_origcwd.empty()) {
|
139 |
if (o_origcwd.empty()) {
|
129 |
char buf[MAXPATHLEN];
|
140 |
char buf[MAXPATHLEN];
|
|
... |
|
... |
267 |
m_ptrans = new ConfSimple(path_cat(m_confdir, "ptrans").c_str());
|
278 |
m_ptrans = new ConfSimple(path_cat(m_confdir, "ptrans").c_str());
|
268 |
|
279 |
|
269 |
m_ok = true;
|
280 |
m_ok = true;
|
270 |
setKeyDir(cstr_null);
|
281 |
setKeyDir(cstr_null);
|
271 |
|
282 |
|
272 |
m_stpsuffstate.init(this, mimemap, "recoll_noindex");
|
283 |
m_stpsuffstate.init(mimemap);
|
273 |
m_skpnstate.init(this, m_conf, "skippedNames");
|
284 |
m_skpnstate.init(m_conf);
|
274 |
m_rmtstate.init(this, m_conf, "indexedmimetypes");
|
285 |
m_rmtstate.init(m_conf);
|
275 |
m_mdrstate.init(this, m_conf, "metadatacmds");
|
286 |
m_xmtstate.init(m_conf);
|
|
|
287 |
m_mdrstate.init(m_conf);
|
|
|
288 |
|
276 |
return;
|
289 |
return;
|
277 |
}
|
290 |
}
|
278 |
|
291 |
|
279 |
bool RclConfig::updateMainConfig()
|
292 |
bool RclConfig::updateMainConfig()
|
280 |
{
|
293 |
{
|
|
... |
|
... |
285 |
return false;
|
298 |
return false;
|
286 |
string where;
|
299 |
string where;
|
287 |
stringsToString(m_cdirs, where);
|
300 |
stringsToString(m_cdirs, where);
|
288 |
m_reason = string("No/bad main configuration file in: ") + where;
|
301 |
m_reason = string("No/bad main configuration file in: ") + where;
|
289 |
m_ok = false;
|
302 |
m_ok = false;
|
290 |
m_skpnstate.init(this, 0, "skippedNames");
|
303 |
m_skpnstate.init(0);
|
291 |
m_rmtstate.init(this, 0, "indexedmimetypes");
|
304 |
m_rmtstate.init(0);
|
292 |
m_mdrstate.init(this, 0, "metadatacmds");
|
305 |
m_xmtstate.init(0);
|
|
|
306 |
m_mdrstate.init(0);
|
293 |
return false;
|
307 |
return false;
|
294 |
}
|
308 |
}
|
|
|
309 |
|
295 |
delete m_conf;
|
310 |
delete m_conf;
|
296 |
m_conf = newconf;
|
311 |
m_conf = newconf;
|
297 |
m_skpnstate.init(this, m_conf, "skippedNames");
|
312 |
|
298 |
m_rmtstate.init(this, m_conf, "indexedmimetypes");
|
313 |
m_skpnstate.init(m_conf);
|
299 |
m_mdrstate.init(this, m_conf, "metadatacmds");
|
314 |
m_rmtstate.init(m_conf);
|
|
|
315 |
m_xmtstate.init(m_conf);
|
|
|
316 |
m_mdrstate.init(m_conf);
|
300 |
|
317 |
|
301 |
setKeyDir(cstr_null);
|
318 |
setKeyDir(cstr_null);
|
302 |
bool nocjk = false;
|
319 |
bool nocjk = false;
|
303 |
if (getConfParam("nocjk", &nocjk) && nocjk == true) {
|
320 |
if (getConfParam("nocjk", &nocjk) && nocjk == true) {
|
304 |
TextSplit::cjkProcessing(false);
|
321 |
TextSplit::cjkProcessing(false);
|
|
... |
|
... |
675 |
}
|
692 |
}
|
676 |
|
693 |
|
677 |
string RclConfig::getMimeHandlerDef(const string &mtype, bool filtertypes)
|
694 |
string RclConfig::getMimeHandlerDef(const string &mtype, bool filtertypes)
|
678 |
{
|
695 |
{
|
679 |
string hs;
|
696 |
string hs;
|
|
|
697 |
|
|
|
698 |
if (filtertypes) {
|
680 |
if (filtertypes && m_rmtstate.needrecompute()) {
|
699 |
if(m_rmtstate.needrecompute()) {
|
681 |
m_restrictMTypes.clear();
|
700 |
m_restrictMTypes.clear();
|
682 |
stringToStrings(stringtolower((const string&)m_rmtstate.savedvalue),
|
701 |
stringToStrings(stringtolower((const string&)m_rmtstate.savedvalue),
|
683 |
m_restrictMTypes);
|
702 |
m_restrictMTypes);
|
684 |
}
|
703 |
}
|
685 |
if (filtertypes && !m_restrictMTypes.empty()) {
|
704 |
if (m_xmtstate.needrecompute()) {
|
686 |
string mt = mtype;
|
705 |
m_excludeMTypes.clear();
|
687 |
stringtolower(mt);
|
706 |
stringToStrings(stringtolower((const string&)m_xmtstate.savedvalue),
|
688 |
if (m_restrictMTypes.find(mt) == m_restrictMTypes.end())
|
707 |
m_excludeMTypes);
|
|
|
708 |
}
|
|
|
709 |
if (!m_restrictMTypes.empty() &&
|
|
|
710 |
!m_restrictMTypes.count(stringtolower(mtype))) {
|
|
|
711 |
LOGDEB2(("RclConfig::getMimeHandlerDef: not in mime type list\n"));
|
689 |
return hs;
|
712 |
return hs;
|
690 |
}
|
713 |
}
|
|
|
714 |
if (!m_excludeMTypes.empty() &&
|
|
|
715 |
m_excludeMTypes.count(stringtolower(mtype))) {
|
|
|
716 |
LOGDEB2(("RclConfig::getMimeHandlerDef: in excluded mime list\n"));
|
|
|
717 |
return hs;
|
|
|
718 |
}
|
|
|
719 |
}
|
|
|
720 |
|
691 |
if (!mimeconf->get(mtype, hs, "index")) {
|
721 |
if (!mimeconf->get(mtype, hs, "index")) {
|
692 |
LOGDEB1(("getMimeHandler: no handler for '%s'\n", mtype.c_str()));
|
722 |
LOGDEB1(("getMimeHandler: no handler for '%s'\n", mtype.c_str()));
|
693 |
}
|
723 |
}
|
694 |
return hs;
|
724 |
return hs;
|
695 |
}
|
725 |
}
|
|
... |
|
... |
1395 |
if (r.m_stopsuffixes)
|
1425 |
if (r.m_stopsuffixes)
|
1396 |
m_stopsuffixes = new SuffixStore(*((SuffixStore*)r.m_stopsuffixes));
|
1426 |
m_stopsuffixes = new SuffixStore(*((SuffixStore*)r.m_stopsuffixes));
|
1397 |
m_maxsufflen = r.m_maxsufflen;
|
1427 |
m_maxsufflen = r.m_maxsufflen;
|
1398 |
m_defcharset = r.m_defcharset;
|
1428 |
m_defcharset = r.m_defcharset;
|
1399 |
|
1429 |
|
1400 |
m_stpsuffstate.init(this, mimemap, r.m_stpsuffstate.paramname);
|
1430 |
m_stpsuffstate.init(mimemap);
|
1401 |
m_skpnstate.init(this, m_conf, r.m_skpnstate.paramname);
|
1431 |
m_skpnstate.init(m_conf);
|
1402 |
m_rmtstate.init(this, m_conf, r.m_rmtstate.paramname);
|
1432 |
m_rmtstate.init(m_conf);
|
1403 |
m_mdrstate.init(this, m_conf, r.m_mdrstate.paramname);
|
1433 |
m_xmtstate.init(m_conf);
|
|
|
1434 |
m_mdrstate.init(m_conf);
|
|
|
1435 |
|
1404 |
m_thrConf = r.m_thrConf;
|
1436 |
m_thrConf = r.m_thrConf;
|
1405 |
}
|
1437 |
}
|
1406 |
|
1438 |
|
1407 |
#else // -> Test
|
1439 |
#else // -> Test
|
1408 |
|
1440 |
|