chiark / gitweb /
'listen' option now uses struct netaddress too.
[disorder] / lib / configuration.c
index 8ec79c76294771ae8027b76eca6beefc23b7095e..5691e8ae24e518fa1d79ab3fe53d1a317281ae0a 100644 (file)
@@ -854,24 +854,6 @@ static int validate_addrport(const struct config_state attribute((unused)) *cs,
   }
 }
 
-static int validate_port(const struct config_state attribute((unused)) *cs,
-                        int nvec,
-                        char attribute((unused)) **vec) {
-  switch(nvec) {
-  case 0:
-    error(0, "%s:%d: missing address",
-         cs->path, cs->line);
-    return -1;
-  case 1:
-  case 2:
-    return 0;
-  default:
-    error(0, "%s:%d: expected [ADDRESS] PORT",
-         cs->path, cs->line);
-    return -1;
-  }
-}
-
 static int validate_algo(const struct config_state attribute((unused)) *cs,
                         int nvec,
                         char **vec) {
@@ -960,7 +942,7 @@ static const struct conf conf[] = {
   { C(gap),              &type_integer,          validate_non_negative },
   { C(history),          &type_integer,          validate_positive },
   { C(home),             &type_string,           validate_isabspath },
-  { C(listen),           &type_stringlist,       validate_port },
+  { C(listen),           &type_netaddress,       validate_any },
   { C(lock),             &type_boolean,          validate_any },
   { C(mail_sender),      &type_string,           validate_any },
   { C(mixer),            &type_string,           validate_any },
@@ -1240,6 +1222,7 @@ static struct config *config_default(void) {
   }
   c->broadcast.af = -1;
   c->broadcast_from.af = -1;
+  c->listen.af = -1;
   return c;
 }