summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
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 {