X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/ba937f0119d6102d2af9cc777cce495e65544952..401d3485a7923ae9b83b23399bee0ef8d19d0444:/lib/configuration.c?ds=sidebyside
diff --git a/lib/configuration.c b/lib/configuration.c
index ca7d86e..2a0b89c 100644
--- a/lib/configuration.c
+++ b/lib/configuration.c
@@ -3,31 +3,25 @@
* Copyright (C) 2004-2008 Richard Kettlewell
* Portions copyright (C) 2007 Mark Wooding
*
- * This program is free software; you can redistribute it and/or modify
+ * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * along with this program. If not, see .
*/
/** @file lib/configuration.c
* @brief Configuration file support
*/
-#include
-#include "types.h"
+#include "common.h"
-#include
-#include
-#include
#include
#include
#include
@@ -966,6 +960,7 @@ static const struct conf conf[] = {
{ C2(restrict, restrictions), &type_restrict, validate_any },
{ C(sample_format), &type_sample_format, validate_sample_format },
{ C(scratch), &type_string_accum, validate_isreg },
+ { C(sendmail), &type_string, validate_isabspath },
{ C(short_display), &type_integer, validate_positive },
{ C(signal), &type_signal, validate_any },
{ C(smtp_server), &type_string, validate_any },
@@ -1194,11 +1189,14 @@ static struct config *config_default(void) {
c->dbversion = 2;
c->cookie_login_lifetime = 86400;
c->cookie_key_lifetime = 86400 * 7;
+ if(sendmail_binary[0] && strcmp(sendmail_binary, "none"))
+ c->sendmail = xstrdup(sendmail_binary);
c->smtp_server = xstrdup("127.0.0.1");
c->new_max = 100;
c->reminder_interval = 600; /* 10m */
c->new_bias_age = 7 * 86400; /* 1 week */
- c->new_bias = 9000000; /* 100 times the base weight */
+ c->new_bias = 4500000; /* 50 times the base weight */
+ c->sox_generation = DEFAULT_SOX_GENERATION;
/* Default stopwords */
if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords))
exit(1);
@@ -1214,7 +1212,7 @@ static struct config *config_default(void) {
return c;
}
-static char *get_file(struct config *c, const char *name) {
+char *config_get_file2(struct config *c, const char *name) {
char *s;
byte_xasprintf(&s, "%s/%s", c->home, name);
@@ -1249,7 +1247,7 @@ static void config_postdefaults(struct config *c,
int n;
static const char *namepart[][4] = {
- { "title", "/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$", "$2", "display" },
+ { "title", "/([0-9]+ *[-:]? *)?([^/]+)\\.[a-zA-Z0-9]+$", "$2", "display" },
{ "title", "/([^/]+)\\.[a-zA-Z0-9]+$", "$1", "sort" },
{ "album", "/([^/]+)/[^/]+$", "$1", "*" },
{ "artist", "/([^/]+)/[^/]+/[^/]+$", "$1", "*" },
@@ -1258,7 +1256,7 @@ static void config_postdefaults(struct config *c,
#define NNAMEPART (int)(sizeof namepart / sizeof *namepart)
static const char *transform[][5] = {
- { "track", "^.*/([0-9]+ *[-:] *)?([^/]+)\\.[a-zA-Z0-9]+$", "$2", "display", "" },
+ { "track", "^.*/([0-9]+ *[-:]? *)?([^/]+)\\.[a-zA-Z0-9]+$", "$2", "display", "" },
{ "track", "^.*/([^/]+)\\.[a-zA-Z0-9]+$", "$1", "sort", "" },
{ "dir", "^.*/([^/]+)$", "$1", "*", "" },
{ "dir", "^(the) ([^/]*)", "$2, $1", "sort", "i", },
@@ -1412,7 +1410,7 @@ char *config_usersysconf(const struct passwd *pw) {
}
char *config_get_file(const char *name) {
- return get_file(config, name);
+ return config_get_file2(config, name);
}
/*