chiark / gitweb /
Online registration now sends email. The confirmation URL doesn't
[disorder] / lib / configuration.c
index 7ed92761d76fe0fe86137b3922f55bedee43bf76..e5dd120757ce536761c2dd0defe5a3f2d39d50c1 100644 (file)
@@ -928,6 +928,7 @@ static const struct conf conf[] = {
   { C(home),             &type_string,           validate_isabspath },
   { C(listen),           &type_stringlist,       validate_port },
   { C(lock),             &type_boolean,          validate_any },
+  { C(mail_sender),      &type_string,           validate_any },
   { C(mixer),            &type_string,           validate_ischr },
   { C(multicast_loop),   &type_boolean,          validate_any },
   { C(multicast_ttl),    &type_integer,          validate_non_negative },
@@ -948,6 +949,7 @@ static const struct conf conf[] = {
   { C(scratch),          &type_string_accum,     validate_isreg },
   { C(short_display),    &type_integer,          validate_positive },
   { C(signal),           &type_signal,           validate_any },
+  { C(smtp_server),      &type_string,           validate_any },
   { C(sox_generation),   &type_integer,          validate_non_negative },
   { C(speaker_backend),  &type_backend,          validate_any },
   { C(speaker_command),  &type_string,           validate_any },
@@ -1044,12 +1046,77 @@ static int config_include(struct config *c, const char *path) {
   return ret;
 }
 
+static const char *const default_stopwords[] = {
+  "stopword",
+
+  "01",
+  "02",
+  "03",
+  "04",
+  "05",
+  "06",
+  "07",
+  "08",
+  "09",
+  "1",
+  "10",
+  "11",
+  "12",
+  "13",
+  "14",
+  "15",
+  "16",
+  "17",
+  "18",
+  "19",
+  "2",
+  "20",
+  "21",
+  "22",
+  "23",
+  "24",
+  "25",
+  "26",
+  "27",
+  "28",
+  "29",
+  "3",
+  "30",
+  "4",
+  "5",
+  "6",
+  "7",
+  "8",
+  "9",
+  "a",
+  "am",
+  "an",
+  "and",
+  "as",
+  "for",
+  "i",
+  "im",
+  "in",
+  "is",
+  "of",
+  "on",
+  "the",
+  "to",
+  "too",
+  "we",
+};
+#define NDEFAULT_STOPWORDS (sizeof default_stopwords / sizeof *default_stopwords)
+
 /** @brief Make a new default configuration */
 static struct config *config_default(void) {
   struct config *c = xmalloc(sizeof *c);
   const char *logname;
   struct passwd *pw;
+  struct config_state cs;
 
+  cs.path = "<internal>";
+  cs.line = 0;
+  cs.config = c;
   /* Strings had better be xstrdup'd as they will get freed at some point. */
   c->gap = 2;
   c->history = 60;
@@ -1082,6 +1149,9 @@ static struct config *config_default(void) {
   c->dbversion = 2;
   c->cookie_login_lifetime = 86400;
   c->cookie_key_lifetime = 86400 * 7;
+  c->smtp_server = xstrdup("127.0.0.1");
+  if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords))
+    exit(1);
   return c;
 }