about summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-06-24 13:36:24 -0400
committerJune McEnroe <june@causal.agency>2020-06-24 13:36:24 -0400
commit94fb9798c5476a9a3111f3982f357920b18c2fd0 (patch)
tree7f115ff5bd80a4190081fe02df80f209b950ad27 /handle.c
parentColor mentions up to first ": " rather than just ":" (diff)
downloadcatgirl-94fb9798c5476a9a3111f3982f357920b18c2fd0.tar.gz
catgirl-94fb9798c5476a9a3111f3982f357920b18c2fd0.zip
Bump ParamCap to 254
Apparently IRCds have decided that the 15-parameter limit doesn't matter
anymore. 254 is the maximum number of single-byte parameters (following
a single-byte command) which fit in a 512-byte CR-LF-terminated line.
When everyone decides that the 512-byte line length limit doesn't matter
either, I will delete my software and people can use some JavaScript
garbage instead.

This makes struct Message 2080 bytes, but there's only ever one or two
of them around at once. Avoid passing it by value to handle.
Diffstat (limited to '')
-rw-r--r--handle.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/handle.c b/handle.c
index 422cd76..4383cb0 100644
--- a/handle.c
+++ b/handle.c
@@ -1228,17 +1228,17 @@ static int compar(const void *cmd, const void *_handler) {
 	return strcmp(cmd, handler->cmd);
 }
 
-void handle(struct Message msg) {
-	if (!msg.cmd) return;
-	if (msg.tags[TagPos]) {
-		self.pos = strtoull(msg.tags[TagPos], NULL, 10);
+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
+		msg->cmd, Handlers, ARRAY_LEN(Handlers), sizeof(*handler), compar
 	);
 	if (handler) {
-		handler->fn(&msg);
-	} else if (strcmp(msg.cmd, "400") >= 0 && strcmp(msg.cmd, "599") <= 0) {
-		handleErrorGeneric(&msg);
+		handler->fn(msg);
+	} else if (strcmp(msg->cmd, "400") >= 0 && strcmp(msg->cmd, "599") <= 0) {
+		handleErrorGeneric(msg);
 	}
 }