diff options
author | June McEnroe <june@causal.agency> | 2019-11-10 18:14:46 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-11-10 18:14:46 -0500 |
commit | 45fc4fdd0805f4108c83726f8998293d24d48c41 (patch) | |
tree | 0996b7a4bedc57ca2e285a4514b87b6919d8fd70 | |
parent | Filter ACCOUNT, AWAY, CHGHOST for incapable clients (diff) | |
download | pounce-45fc4fdd0805f4108c83726f8998293d24d48c41.tar.gz pounce-45fc4fdd0805f4108c83726f8998293d24d48c41.zip |
Request all supported caps from server
-rw-r--r-- | state.c | 11 |
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]); } |