about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-20 19:22:20 -0400
committerJune McEnroe <june@causal.agency>2021-06-20 19:22:20 -0400
commite2bebca7dcfa0af3e3a39b819595cfad593a49d8 (patch)
treeef38a500fcd7e302c9e9fc703816215d2353c83e
parentDon't match actions in notices (diff)
downloadcatgirl-e2bebca7dcfa0af3e3a39b819595cfad593a49d8.tar.gz
catgirl-e2bebca7dcfa0af3e3a39b819595cfad593a49d8.zip
Handle "\1ACTION\1" empty actions
-rw-r--r--handle.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/handle.c b/handle.c
index bdf6db0..bfe6e8c 100644
--- a/handle.c
+++ b/handle.c
@@ -1163,10 +1163,18 @@ static void handleReplyNowAway(struct Message *msg) {
 }
 
 static bool isAction(struct Message *msg) {
-	if (strncmp(msg->params[1], "\1ACTION ", 8)) return false;
-	msg->params[1] += 8;
+	if (strncmp(msg->params[1], "\1ACTION", 7)) return false;
+	if (msg->params[1][7] == ' ') {
+		msg->params[1] += 8;
+	} else if (msg->params[1][7] == '\1') {
+		msg->params[1] += 7;
+	} else {
+		return false;
+	}
 	size_t len = strlen(msg->params[1]);
-	if (msg->params[1][len - 1] == '\1') msg->params[1][len - 1] = '\0';
+	if (msg->params[1][len - 1] == '\1') {
+		msg->params[1][len - 1] = '\0';
+	}
 	return true;
 }