about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-21 15:29:10 -0500
committerJune McEnroe <june@causal.agency>2020-12-21 15:29:10 -0500
commit1829dc40c6c3af3768a9feaa99f4aabbb34eca23 (patch)
tree2086d7c0da70e649ef45be76e192afccccc8b806
parentAlphabetize STANDARDS sections (diff)
downloadpounce-1829dc40c6c3af3768a9feaa99f4aabbb34eca23.tar.gz
pounce-1829dc40c6c3af3768a9feaa99f4aabbb34eca23.zip
Send CAP END if CAP LS response is empty
Or only unsupported caps. Or, as the corresponding commit in catgirl
says, "if CAP LS doesn't list anything good."
-rw-r--r--state.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/state.c b/state.c
index 14af068..41ffdd0 100644
--- a/state.c
+++ b/state.c
@@ -90,7 +90,11 @@ static void handleCap(struct Message *msg) {
 
 	if (!strcmp(msg->params[1], "LS") || !strcmp(msg->params[1], "NEW")) {
 		caps &= ~(CapSASL | CapSTS | CapUnsupported);
-		if (caps) serverFormat("CAP REQ :%s\r\n", capList(caps, NULL));
+		if (caps) {
+			serverFormat("CAP REQ :%s\r\n", capList(caps, NULL));
+		} else {
+			if (!(stateCaps & CapSASL)) serverFormat("CAP END\r\n");
+		}
 
 	} else if (!strcmp(msg->params[1], "ACK")) {
 		stateCaps |= caps;