summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-11-09 20:17:43 -0500
committerJune McEnroe <june@causal.agency>2019-11-09 20:17:43 -0500
commitd4ff0457718b573d2c9d20000c63014666bf5791 (patch)
tree0d7ffe78cdd734dbce769629ecf18b689a669b21 /client.c
parentParse capabilities (diff)
downloadpounce-d4ff0457718b573d2c9d20000c63014666bf5791.tar.gz
pounce-d4ff0457718b573d2c9d20000c63014666bf5791.zip
Maintain stateCaps and offer them to clients
Diffstat (limited to '')
-rw-r--r--client.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/client.c b/client.c
index 9bbc5d9..40bba1c 100644
--- a/client.c
+++ b/client.c
@@ -150,6 +150,7 @@ static void handlePass(struct Client *client, struct Message *msg) {
 
 static void handleCap(struct Client *client, struct Message *msg) {
 	if (!msg->params[0]) msg->params[0] = "";
+	enum Cap avail = CapServerTime | (stateCaps & ~CapSASL);
 
 	if (!strcmp(msg->params[0], "END")) {
 		if (!client->need) return;
@@ -158,15 +159,12 @@ 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(CapServerTime)
-		);
+		clientFormat(client, ":%s CAP * LS :%s\r\n", ORIGIN, capList(avail));
 
 	} else if (!strcmp(msg->params[0], "REQ") && msg->params[1]) {
 		if (client->need) client->need |= NeedCapEnd;
 		enum Cap caps = capParse(msg->params[1]);
-		if (caps == CapServerTime) {
+		if (caps == (avail & caps)) {
 			client->caps |= caps;
 			clientFormat(client, ":%s CAP * ACK :%s\r\n", ORIGIN, msg->params[1]);
 		} else {