summary refs log tree commit diff
diff options
context:
space:
mode:
-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]);
 	}
.c?id=10d9be50e919b6e7d5814b579eeabfa617dc801e&follow=1'>Use a table to decode base64June McEnroe 2020-04-29Fix infinite loop if exportAtom can't find a text partJune McEnroe Oops. But also why the hell are people making multipart/alternative with only text/html inside? 2020-04-29Highlight diff/index/---/+++ lines of patches as wellJune McEnroe 2020-04-29Turn URLs into HTML linksJune McEnroe 2020-04-28Clean up html.cJune McEnroe 2020-04-27Style groups in recipientsJune McEnroe Can't actually test this oops. 2020-04-27Clean up export.cJune McEnroe 2020-04-27Clean up decode.cJune McEnroe 2020-04-26Free orderJune McEnroe Oops 2. 2020-04-26Clean up atom.c and fix base URLsJune McEnroe Base URL should not be URL escaped! 2020-04-26Clean up archive.cJune McEnroe 2020-04-26Add -q to exit non-zero on early exitJune McEnroe 2020-04-26Rearrange some of archive.hJune McEnroe 2020-04-26Free part.parts.ptrJune McEnroe Oops. 2020-04-26Rename part->id to part->contentIDJune McEnroe Disambiguate with messageID. 2020-04-26Iterate through nested multiparts to find content for AtomJune McEnroe Also fixes content for multipart/signed. 2020-04-26Include Cc address in reply mailtosJune McEnroe 2020-04-26Use %R for RFC numbers in STANDARDS sectionJune McEnroe 2020-04-26Add mailto spec to STANDARDSJune McEnroe 2020-04-26Increase space between nav itemsJune McEnroe 2020-04-26Add mailto address for the archiveJune McEnroe 2020-04-26Put dates on new lines in indexJune McEnroe 2020-04-26Include <> around Message-Id in mailto: URLsJune McEnroe 2020-04-26Add link to index on thread pagesJune McEnroe 2020-04-26Fall back to Content-Type name parameter for attachmentsJune McEnroe 2020-04-26Remove margins in article.message headerJune McEnroe 2020-04-26Generate index.atomJune McEnroe 2020-04-26Generate XHTML content in Atom entriesJune McEnroe 2020-04-25Style index pageJune McEnroe 2020-04-25Render index.htmlJune McEnroe 2020-04-25Wrap <summary> replies count in <data>June McEnroe 2020-04-25Accumulate thread envelopes before concatenationJune McEnroe 2020-04-24Free envelope in concatDataJune McEnroe 2020-04-24Use replyTo address in mailto:June McEnroe 2020-04-23Wrap quoted lines in <q>June McEnroe