summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2023-10-11 14:00:45 -0400
committerJune McEnroe <june@causal.agency>2023-10-11 14:00:45 -0400
commit91d43245c77ab1408e9a5506d79e0ae2822078a2 (patch)
tree0d2f6958e637b552c29c3875e563d22503afc401
parentMove sandman to top-level, add --enable-sandman (diff)
downloadcatgirl-91d43245c77ab1408e9a5506d79e0ae2822078a2.tar.gz
catgirl-91d43245c77ab1408e9a5506d79e0ae2822078a2.zip
Remove kiosk mode
I'm fairly certain I was the only one to ever use it, and I don't
anymore.
-rw-r--r--catgirl.120
-rw-r--r--chat.c14
-rw-r--r--chat.h1
-rw-r--r--command.c24
4 files changed, 15 insertions, 44 deletions
diff --git a/catgirl.1 b/catgirl.1
index 32eb365..56513b6 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd May 29, 2022
+.Dd October 11, 2023
 .Dt CATGIRL 1
 .Os
 .
@@ -8,7 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
-.Op Fl KRelqv
+.Op Fl Relqv
 .Op Fl C Ar copy
 .Op Fl H Ar hash
 .Op Fl I Ar highlight
@@ -145,22 +145,6 @@ The commands which can be matched are:
 .Sy QUIT ,
 .Sy SETNAME .
 .
-.It Fl K | Cm kiosk
-Disable the
-.Ic /copy ,
-.Ic /debug ,
-.Ic /exec ,
-.Ic /join ,
-.Ic /list ,
-.Ic /msg ,
-.Ic /open ,
-.Ic /part ,
-.Ic /query ,
-.Ic /quote
-commands.
-Replace the username
-with a hash of its original value.
-.
 .It Fl N Ar util | Cm notify No = Ar util
 Send notifications using a utility.
 Subsequent
diff --git a/chat.c b/chat.c
index 8c425d4..6728240 100644
--- a/chat.c
+++ b/chat.c
@@ -245,7 +245,6 @@ int main(int argc, char *argv[]) {
 		{ .val = 'C', .name = "copy", required_argument },
 		{ .val = 'H', .name = "hash", required_argument },
 		{ .val = 'I', .name = "highlight", required_argument },
-		{ .val = 'K', .name = "kiosk", no_argument },
 		{ .val = 'N', .name = "notify", required_argument },
 		{ .val = 'O', .name = "open", required_argument },
 		{ .val = 'R', .name = "restrict", no_argument },
@@ -286,7 +285,6 @@ int main(int argc, char *argv[]) {
 			break; case 'C': utilPush(&urlCopyUtil, optarg);
 			break; case 'H': parseHash(optarg);
 			break; case 'I': filterAdd(Hot, optarg);
-			break; case 'K': self.kiosk = true;
 			break; case 'N': utilPush(&uiNotifyUtil, optarg);
 			break; case 'O': utilPush(&urlOpenUtil, optarg);
 			break; case 'R': self.restricted = true;
@@ -341,13 +339,6 @@ int main(int argc, char *argv[]) {
 	if (!user) user = self.nicks[0];
 	if (!real) real = self.nicks[0];
 
-	if (self.kiosk) {
-		char *hash;
-		int n = asprintf(&hash, "%08" PRIx32, _hash(user));
-		if (n < 0) err(EX_OSERR, "asprintf");
-		user = hash;
-	}
-
 	if (pass && !pass[0]) {
 		char *buf = malloc(512);
 		if (!buf) err(EX_OSERR, "malloc");
@@ -418,8 +409,7 @@ int main(int argc, char *argv[]) {
 	signal(SIGTERM, signalHandler);
 	signal(SIGCHLD, signalHandler);
 
-	bool pipes = !self.kiosk && !self.restricted;
-	if (pipes) {
+	if (!self.restricted) {
 		int error = pipe(utilPipe) || pipe(execPipe);
 		if (error) err(EX_OSERR, "pipe");
 
@@ -437,7 +427,7 @@ int main(int argc, char *argv[]) {
 		{ .events = POLLIN, .fd = execPipe[0] },
 	};
 	while (!self.quit) {
-		int nfds = poll(fds, (pipes ? ARRAY_LEN(fds) : 2), -1);
+		int nfds = poll(fds, (self.restricted ? 2 : ARRAY_LEN(fds)), -1);
 		if (nfds < 0 && errno != EINTR) err(EX_IOERR, "poll");
 		if (nfds > 0) {
 			if (fds[0].revents) inputRead();
diff --git a/chat.h b/chat.h
index 6753fcb..2a41cf6 100644
--- a/chat.h
+++ b/chat.h
@@ -202,7 +202,6 @@ enum Cap {
 
 extern struct Self {
 	bool debug;
-	bool kiosk;
 	bool restricted;
 	size_t pos;
 	enum Cap caps;
diff --git a/command.c b/command.c
index b09b342..502ff17 100644
--- a/command.c
+++ b/command.c
@@ -560,7 +560,6 @@ static void commandHelp(uint id, char *params) {
 enum Flag {
 	BIT(Multiline),
 	BIT(Restrict),
-	BIT(Kiosk),
 };
 
 static const struct Handler {
@@ -572,37 +571,37 @@ static const struct Handler {
 	{ "/away", commandAway, 0, 0 },
 	{ "/ban", commandBan, 0, 0 },
 	{ "/close", commandClose, 0, 0 },
-	{ "/copy", commandCopy, Restrict | Kiosk, 0 },
+	{ "/copy", commandCopy, Restrict, 0 },
 	{ "/cs", commandCS, 0, 0 },
-	{ "/debug", commandDebug, Kiosk, 0 },
+	{ "/debug", commandDebug, 0, 0 },
 	{ "/deop", commandDeop, 0, 0 },
 	{ "/devoice", commandDevoice, 0, 0 },
 	{ "/except", commandExcept, 0, 0 },
-	{ "/exec", commandExec, Multiline | Restrict | Kiosk, 0 },
+	{ "/exec", commandExec, Multiline | Restrict, 0 },
 	{ "/help", commandHelp, 0, 0 }, // Restrict special case.
 	{ "/highlight", commandHighlight, 0, 0 },
 	{ "/ignore", commandIgnore, 0, 0 },
 	{ "/invex", commandInvex, 0, 0 },
 	{ "/invite", commandInvite, 0, 0 },
-	{ "/join", commandJoin, Kiosk, 0 },
+	{ "/join", commandJoin, 0, 0 },
 	{ "/kick", commandKick, 0, 0 },
-	{ "/list", commandList, Kiosk, 0 },
+	{ "/list", commandList, 0, 0 },
 	{ "/me", commandMe, Multiline, 0 },
 	{ "/mode", commandMode, 0, 0 },
 	{ "/move", commandMove, 0, 0 },
-	{ "/msg", commandMsg, Multiline | Kiosk, 0 },
+	{ "/msg", commandMsg, Multiline, 0 },
 	{ "/names", commandNames, 0, 0 },
 	{ "/nick", commandNick, 0, 0 },
 	{ "/notice", commandNotice, Multiline, 0 },
 	{ "/ns", commandNS, 0, 0 },
-	{ "/o", commandOpen, Restrict | Kiosk, 0 },
+	{ "/o", commandOpen, Restrict, 0 },
 	{ "/op", commandOp, 0, 0 },
-	{ "/open", commandOpen, Restrict | Kiosk, 0 },
+	{ "/open", commandOpen, Restrict, 0 },
 	{ "/ops", commandOps, 0, 0 },
-	{ "/part", commandPart, Kiosk, 0 },
-	{ "/query", commandQuery, Kiosk, 0 },
+	{ "/part", commandPart, 0, 0 },
+	{ "/query", commandQuery, 0, 0 },
 	{ "/quit", commandQuit, 0, 0 },
-	{ "/quote", commandQuote, Multiline | Kiosk, 0 },
+	{ "/quote", commandQuote, Multiline, 0 },
 	{ "/say", commandPrivmsg, Multiline, 0 },
 	{ "/setname", commandSetname, 0, CapSetname },
 	{ "/topic", commandTopic, 0, 0 },
@@ -672,7 +671,6 @@ size_t commandWillSplit(uint id, const char *input) {
 
 static bool commandAvailable(const struct Handler *handler) {
 	if (handler->flags & Restrict && self.restricted) return false;
-	if (handler->flags & Kiosk && self.kiosk) return false;
 	if (handler->caps && (handler->caps & self.caps) != handler->caps) {
 		return false;
 	}