summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-11-10 19:23:52 -0500
committerJune McEnroe <june@causal.agency>2019-11-10 19:23:52 -0500
commit5ca40fc488de638a155a659f0334c7fb8b99b7a2 (patch)
tree7158c5b4ceef01faf20677298ed085b159668d39 /client.c
parentExpand client configuration documentation and list capabilities (diff)
downloadpounce-5ca40fc488de638a155a659f0334c7fb8b99b7a2.tar.gz
pounce-5ca40fc488de638a155a659f0334c7fb8b99b7a2.zip
Filter extended-join
Diffstat (limited to '')
-rw-r--r--client.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/client.c b/client.c
index ec07b91..3ea00c8 100644
--- a/client.c
+++ b/client.c
@@ -299,10 +299,23 @@ static const char *filterChghost(const char *line) {
 	return (strcmp(cmd(line), "CHGHOST") ? line : NULL);
 }
 
+static const char *filterExtendedJoin(const char *line) {
+	if (strcmp(cmd(line), "JOIN")) return line;
+	size_t len = 0;
+	for (int i = 0; i < 3; ++i) {
+		len += strcspn(&line[len], " ");
+		if (line[len]) len++;
+	}
+	static char buf[512];
+	snprintf(buf, sizeof(buf), "%.*s", (int)len, line);
+	return buf;
+}
+
 static Filter *Filters[] = {
 	[CapAccountNotifyBit] = filterAccountNotify,
 	[CapAwayNotifyBit] = filterAwayNotify,
 	[CapChghostBit] = filterChghost,
+	[CapExtendedJoinBit] = filterExtendedJoin,
 };
 
 void clientConsume(struct Client *client) {