summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-01-04 16:16:49 -0500
committerJune McEnroe <june@causal.agency>2020-01-04 16:16:49 -0500
commit61f01795fcc16e714cb7f826f944345f5d23ed9b (patch)
treeb7012986cc139d5d3118066444418be87be88df5
parentSet the default network name to the hostname (diff)
downloadlitterbox-61f01795fcc16e714cb7f826f944345f5d23ed9b.tar.gz
litterbox-61f01795fcc16e714cb7f826f944345f5d23ed9b.zip
Add -N option to litterbox
-rw-r--r--litterbox.19
-rw-r--r--litterbox.c6
2 files changed, 12 insertions, 3 deletions
diff --git a/litterbox.1 b/litterbox.1
index a5b287f..6501850 100644
--- a/litterbox.1
+++ b/litterbox.1
@@ -1,4 +1,4 @@
-.Dd January 3, 2020
+.Dd January 4, 2020
 .Dt LITTERBOX 1
 .Os
 .
@@ -9,6 +9,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl Qqv
+.Op Fl N Ar network
 .Op Fl d Ar path
 .Op Fl h Ar host
 .Op Fl j Ar join
@@ -45,6 +46,12 @@ an existing database can be migrated with
 The arguments are as follows:
 .
 .Bl -tag -width "-h host"
+.It Fl N Ar network
+Set the network name to be used
+if the server does not send
+.Sy RPL_ISUPPORT NETWORK .
+The default is the server hostname.
+.
 .It Fl Q
 Enable the public search query interface.
 This allows anyone to perform searches
diff --git a/litterbox.c b/litterbox.c
index c6cee84..4c97794 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -618,15 +618,17 @@ int main(int argc, char *argv[]) {
 	bool insecure = false;
 	const char *host = NULL;
 	const char *port = "6697";
+	const char *defaultNetwork = NULL;
 
 	const char *nick = "litterbox";
 	const char *user = NULL;
 	const char *pass = NULL;
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "!Qd:h:ij:l:mn:p:qu:vw:"))) {
+	while (0 < (opt = getopt(argc, argv, "!N:Qd:h:ij:l:mn:p:qu:vw:"))) {
 		switch (opt) {
 			break; case '!': insecure = true;
+			break; case 'N': defaultNetwork = optarg;
 			break; case 'Q': searchQuery = Public;
 			break; case 'd': path = optarg;
 			break; case 'h': host = optarg;
@@ -665,7 +667,7 @@ int main(int argc, char *argv[]) {
 
 	if (!host) errx(EX_USAGE, "host required");
 	set(&self, "*");
-	set(&network, host);
+	set(&network, (defaultNetwork ? defaultNetwork : host));
 	set(&chanTypes, "#&");
 	set(&prefixes, "@+");
 
an title='2022-07-26 16:07:59 -0400'>2022-07-26Update Care with time-to-ID and piercingsJune McEnroe 2022-07-26Add -w to upJune McEnroe 2022-07-13Set push.autoSetupRemoteJune McEnroe 2022-07-08Remove TOURJune McEnroe 2022-07-03Add The Bone Shard EmperorJune McEnroe 2022-06-25Bump xterm font size to 12June McEnroe 2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe