make
```
-Some things are configurable via compile-time flags. In particular, `-DHAS_TLS`
-and some constants defined in `src/config.h`. See the section on paths for
-additional flags.
+Some things are configurable via compile-time flags. See the section on paths.
## Config files
These have to go in datadir (see below).
`help.txt` file contains the text for the HELP command. You can use the provided
`help.example.txt` file. Similarly, `motd.txt` contains the MOTD text.
+`admin.txt` file contains info displayed by the ADMIN command. First line is
+supposed to be the geographical location of the server. Second line is the
+organization running the server. Third line is a contact email address.
+You can set these to whatever you want, though setting a contact email is
+recommended.
+
When the server starts, it reads the `init.txt` file. A fake oper connection
performs the actions specified in the file. This allows initializing permanent
channels. If you specify source (i.e. `:nick!user@host` before the command),
## Paths
Data directory can be configured with `--datadir` argument. The default can be
-configured at compile time via `IRCDDATADIR` define. Otherwise it deafults to
+configured at compile time via `IRCDDATADIR` define. Otherwise it defaults to
`LOCALSTATEDIR/lib/patchyircd` if `LOCALSTATEDIR` is defined. Otherwise it's
`data` in the working directory.
return err_notregistered(client), sendbuf(client), 0;
if (args[0] && strcmp(args[0], hostname) != 0)
return err_nosuchserver(client, args[0]), sendbuf(client), 0;
- rpl_adminme(client), sendbuf(client);
- rpl_adminloc1(client, ADMINLOC1), sendbuf(client);
- rpl_adminloc2(client, ADMINLOC2), sendbuf(client);
- rpl_adminemail(client, ADMINEMAIL), sendbuf(client);
+ char line[512];
+ FILE *f = fopen(getdatafile("admin.txt"), "r" FOPEN_CLOEXEC);
+ if (f) {
+ auto nextline = [f, &line]()->bool{
+ if (fgets(line, 512, f)) {
+ char *c = strchr(line, '\n');
+ if (*c)
+ *c = '\0';
+ return true;
+ }
+ return false;
+ };
+ rpl_adminme(client), sendbuf(client);
+ if (nextline()) {
+ rpl_adminloc1(client, line), sendbuf(client);
+ if (nextline()) {
+ rpl_adminloc2(client, line), sendbuf(client);
+ if (nextline())
+ rpl_adminemail(client, line), sendbuf(client);
+ }
+ }
+ fclose(f);
+ } else {
+ goto unknown;
+ }
} else if(strcmp(command, "LUSERS") == 0) {
if (!is_registered(client))
return err_notregistered(client), sendbuf(client), 0;