about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;