summary refs log tree commit diff
path: root/state.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-11-10 18:14:46 -0500
committerJune McEnroe <june@causal.agency>2019-11-10 18:14:46 -0500
commit45fc4fdd0805f4108c83726f8998293d24d48c41 (patch)
tree0996b7a4bedc57ca2e285a4514b87b6919d8fd70 /state.c
parentFilter ACCOUNT, AWAY, CHGHOST for incapable clients (diff)
downloadpounce-45fc4fdd0805f4108c83726f8998293d24d48c41.tar.gz
pounce-45fc4fdd0805f4108c83726f8998293d24d48c41.zip
Request all supported caps from server
Diffstat (limited to 'state.c')
-rw-r--r--state.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/state.c b/state.c
index e17d9e6..b786adb 100644
--- a/state.c
+++ b/state.c
@@ -43,6 +43,7 @@ void stateLogin(
 	const char *pass, bool sasl, const char *plain,
 	const char *nick, const char *user, const char *real
 ) {
+	serverFormat("CAP LS\r\n");
 	if (pass) serverFormat("PASS :%s\r\n", pass);
 	if (sasl) {
 		serverFormat("CAP REQ :%s\r\n", capList(CapSASL));
@@ -59,19 +60,25 @@ void stateLogin(
 	}
 	serverFormat("NICK %s\r\n", nick);
 	serverFormat("USER %s 0 * :%s\r\n", user, real);
-	serverFormat("CAP LS\r\n");
 }
 
 static void handleCap(struct Message *msg) {
 	require(msg, false, 3);
 	enum Cap caps = capParse(msg->params[2]);
-	if (!strcmp(msg->params[1], "ACK")) {
+
+	if (!strcmp(msg->params[1], "LS")) {
+		caps &= ~(CapSASL | CapServerTime | CapUnsupported);
+		serverFormat("CAP REQ :%s\r\n", capList(caps));
+
+	} else if (!strcmp(msg->params[1], "ACK")) {
 		stateCaps |= caps;
 		if (caps & CapSASL) {
 			serverFormat(
 				"AUTHENTICATE %s\r\n", (plainBase64 ? "PLAIN" : "EXTERNAL")
 			);
 		}
+		if (!(stateCaps & CapSASL)) serverFormat("CAP END\r\n");
+
 	} else if (!strcmp(msg->params[1], "NAK")) {
 		errx(EX_CONFIG, "server does not support %s", msg->params[2]);
 	}
nohover-highlight'> 2021-02-04Update cgit-causal-agency to 8e4c63cJune McEnroe 2021-01-20Update cgit-causal-agency to 8a10aa5June McEnroe 2021-01-17Update cgit-causal-agencyJune McEnroe 2021-01-17Update scooper to 1.1June McEnroe 2021-01-17Update catgirl to 1.5 (BONUS WEBISODE)June McEnroe 2021-01-15Update litterbox to 1.7June McEnroe 2021-01-15Update pounce to 2.2June McEnroe 2021-01-15Update catgirl to 1.4June McEnroe 2020-12-28Replace cgit-patched with cgit-causal-agencyJune McEnroe 2020-12-18Add notemap portJune McEnroe 2020-12-15Update libretls to 3.3.1June McEnroe 2020-12-15Update catsit to 1.1June McEnroe 2020-12-15Update pounce to 2.1p1June McEnroe 2020-12-15Add imbox portJune McEnroe 2020-11-24Update pounce to 2.1June McEnroe 2020-11-24Update libretls to 3.3.0June McEnroe 2020-11-17Update catgirl to 1.3June McEnroe 2020-11-17Update libretls to 3.2.2June McEnroe 2020-09-29Update libretls to 3.2.1June McEnroe 2020-09-10Update catgirl to 1.2June McEnroe 2020-09-09Add pounce-palaver portJune McEnroe 2020-09-09Update pounce to 2.0June McEnroe 2020-09-09Update litterbox to 1.6June McEnroe 2020-08-23Add scooper portJune McEnroe 2020-08-23Add catsit portJune McEnroe 2020-08-13Update pounce to 1.4p2June McEnroe 2020-08-11Update pounce to 1.4p1June McEnroe 2020-08-10Add litterbox portJune McEnroe 2020-08-10Add missing USES=pkgconfig to pounceJune McEnroe