summary refs log tree commit diff
path: root/state.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--state.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/state.c b/state.c
index c714628..d840018 100644
--- a/state.c
+++ b/state.c
@@ -74,9 +74,9 @@ static void handleCap(struct Message *msg) {
 	require(msg, false, 3);
 	enum Cap caps = capParse(msg->params[2]);
 
-	if (!strcmp(msg->params[1], "LS")) {
+	if (!strcmp(msg->params[1], "LS") || !strcmp(msg->params[1], "NEW")) {
 		caps &= ~(CapSASL | CapUnsupported);
-		serverFormat("CAP REQ :%s\r\n", capList(caps));
+		if (caps) serverFormat("CAP REQ :%s\r\n", capList(caps));
 
 	} else if (!strcmp(msg->params[1], "ACK")) {
 		stateCaps |= caps;
@@ -87,6 +87,9 @@ static void handleCap(struct Message *msg) {
 		}
 		if (!(stateCaps & CapSASL)) serverFormat("CAP END\r\n");
 
+	} else if (!strcmp(msg->params[1], "DEL")) {
+		stateCaps &= ~caps;
+
 	} else if (!strcmp(msg->params[1], "NAK")) {
 		errx(EX_CONFIG, "server does not support %s", msg->params[2]);
 	}