summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-03-08 23:15:56 -0400
committerJune McEnroe <june@causal.agency>2020-03-08 23:15:56 -0400
commit7e120f00a19c27e0b98e27a2eacacdfce9bd3ca2 (patch)
tree868dee59354b1b1f8c80bcd447f253fbb2c4a145
parentPrevent entering commands in <debug> if restricted (diff)
downloadcatgirl-7e120f00a19c27e0b98e27a2eacacdfce9bd3ca2.tar.gz
catgirl-7e120f00a19c27e0b98e27a2eacacdfce9bd3ca2.zip
Set self.pos before handling the message
This intuitively feels wrong, but isn't. Most importantly, handleError
immediately exits, but we still need to "consume" that message,
otherwise pounce will keep sending it on reconnect. The same goes for
any other handler that might cause an exit, such as a require parameter
count failure.
-rw-r--r--handle.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/handle.c b/handle.c
index 0a1dedb..d0236fd 100644
--- a/handle.c
+++ b/handle.c
@@ -1018,6 +1018,9 @@ static int compar(const void *cmd, const void *_handler) {
 
 void handle(struct Message msg) {
 	if (!msg.cmd) return;
+	if (msg.tags[TagPos]) {
+		self.pos = strtoull(msg.tags[TagPos], NULL, 10);
+	}
 	const struct Handler *handler = bsearch(
 		msg.cmd, Handlers, ARRAY_LEN(Handlers), sizeof(*handler), compar
 	);
@@ -1026,7 +1029,4 @@ void handle(struct Message msg) {
 	} else if (strcmp(msg.cmd, "400") >= 0 && strcmp(msg.cmd, "599") <= 0) {
 		handleErrorGeneric(&msg);
 	}
-	if (msg.tags[TagPos]) {
-		self.pos = strtoull(msg.tags[TagPos], NULL, 10);
-	}
 }
gheader'>2021-01-23Fix /unignore commandJune McEnroe Yikes, copy-paste fail. 2021-01-23Remove use of "%n" to appease de RaadtJune McEnroe Sure, it was completely unnecessary, but I resent being told how to use snprintf. https://cvsweb.openbsd.org/src/lib/libc/stdio/vfprintf.c?rev=1.79&content-type=text/x-cvsweb-markup 2021-01-23Drop filesystem access iff possibleKlemens Nanni Log files and state save/restore both require read/write access to the filesystem, both during start and exit. If neither features are used, catgirl may run with "stdio tty". 2021-01-23Drop exec capability iff restrictedKlemens Nanni Nothing must be executed when running /copy, et al. 2021-01-23Drop network capability after ircConnect()Klemens Nanni catgirl has no reconnect feature and generally must not do anything but read/write from/to the connected socket which does not require "inet" or "dns" promises. 2021-01-23Call pledge(2) after unveil(2)Klemens Nanni Simplify logic, be more idiomatic and finalize by pledging after all unveiling is done by omitting the "unveil" promise and thereby not allowing further calls to it. 2021-01-23Separate kiosk mode from restrict modeJune McEnroe Restrict mode will focus on sandboxing, while kiosk will continue to restrict IRC access through a public kiosk. Kiosk mode without restrict mode allows execution of man 1 catgirl with /help, assuming external sandboxing. The /list and /part commands are also added to the list of disabled commands in kiosk mode, since they are pointless without access to /join. 2021-01-21Simplify windowUpdate loops and factor out windowTopJune McEnroe No idea why I made that more complicated than it had to be looping backwards. 2021-01-21Document that M-l shows timestampsJune McEnroe 2021-01-19Don't lose swapped window when navigating to current bufferJeremy O'Brien 2021-01-19Use Warm heat for manually inserted blank linesJune McEnroe Oops, forgot about these. 2021-01-18Add example tmux(1) configKlemens Nanni Spawn one catgirl per network and handle reconnects through tmux, no extra tool required. 2021-01-17Use Warm heat for blank linesJune McEnroe So they're not hidden by M-+. 2021-01-16Add -I highlight option and /highlightJune McEnroe