summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-27 02:36:32 -0500
committerJune McEnroe <june@causal.agency>2020-02-27 02:36:32 -0500
commit793f564ffd9622e2c879b1ee3591748d602d6118 (patch)
treecc556825581fa1e81ccd4246ad84ae1f2d972970 /client.c
parentSupport cap-notify (diff)
downloadpounce-793f564ffd9622e2c879b1ee3591748d602d6118.tar.gz
pounce-793f564ffd9622e2c879b1ee3591748d602d6118.zip
Support CAP LS 302 from clients
Diffstat (limited to 'client.c')
-rw-r--r--client.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/client.c b/client.c
index 2d5b8e0..f66ea0e 100644
--- a/client.c
+++ b/client.c
@@ -166,6 +166,7 @@ static void handleCap(struct Client *client, struct Message *msg) {
 	if (!msg->params[0]) msg->params[0] = "";
 
 	enum Cap avail = CapServerTime | CapPassive | (stateCaps & ~CapSASL);
+	const char *values[CapBits] = { [CapSASLBit] = "EXTERNAL" };
 	if (clientCA) avail |= CapSASL;
 
 	if (!strcmp(msg->params[0], "END")) {
@@ -175,7 +176,18 @@ static void handleCap(struct Client *client, struct Message *msg) {
 
 	} else if (!strcmp(msg->params[0], "LS")) {
 		if (client->need) client->need |= NeedCapEnd;
-		clientFormat(client, ":%s CAP * LS :%s\r\n", ORIGIN, capList(avail));
+		if (msg->params[1] && !strcmp(msg->params[1], "302")) {
+			if (avail & CapCapNotify) client->caps |= CapCapNotify;
+			clientFormat(
+				client, ":%s CAP * LS :%s\r\n",
+				ORIGIN, capList(avail, values)
+			);
+		} else {
+			clientFormat(
+				client, ":%s CAP * LS :%s\r\n",
+				ORIGIN, capList(avail, NULL)
+			);
+		}
 
 	} else if (!strcmp(msg->params[0], "REQ") && msg->params[1]) {
 		if (client->need) client->need |= NeedCapEnd;
@@ -190,7 +202,7 @@ static void handleCap(struct Client *client, struct Message *msg) {
 	} else if (!strcmp(msg->params[0], "LIST")) {
 		clientFormat(
 			client, ":%s CAP * LIST :%s\r\n",
-			ORIGIN, capList(client->caps)
+			ORIGIN, capList(client->caps, NULL)
 		);
 
 	} else {