diff options
-rw-r--r-- | bounce.h | 1 | ||||
-rw-r--r-- | client.c | 8 | ||||
-rw-r--r-- | pounce.1 | 3 | ||||
-rw-r--r-- | state.c | 7 |
4 files changed, 16 insertions, 3 deletions
diff --git a/bounce.h b/bounce.h index a4b1a91..1655772 100644 --- a/bounce.h +++ b/bounce.h @@ -69,6 +69,7 @@ static inline struct Message parse(char *line) { X("account-tag", CapAccountTag) \ X("away-notify", CapAwayNotify) \ X("batch", CapBatch) \ + X("cap-notify", CapCapNotify) \ X("causal.agency/passive", CapPassive) \ X("chghost", CapChghost) \ X("extended-join", CapExtendedJoin) \ diff --git a/client.c b/client.c index c472f51..2d5b8e0 100644 --- a/client.c +++ b/client.c @@ -421,6 +421,13 @@ static const char *filterBatch(const char *line) { return (wordcmp(line, 0, "BATCH") ? line : NULL); } +static const char *filterCapNotify(const char *line) { + if (wordcmp(line, 0, "CAP")) return line; + if (!wordcmp(line, 1, "NEW")) return NULL; + if (!wordcmp(line, 1, "DEL")) return NULL; + return line; +} + static const char *filterChghost(const char *line) { return (wordcmp(line, 0, "CHGHOST") ? line : NULL); } @@ -488,6 +495,7 @@ static Filter *Filters[] = { [CapAccountNotifyBit] = filterAccountNotify, [CapAwayNotifyBit] = filterAwayNotify, [CapBatchBit] = filterBatch, + [CapCapNotifyBit] = filterCapNotify, [CapChghostBit] = filterChghost, [CapExtendedJoinBit] = filterExtendedJoin, [CapInviteNotifyBit] = filterInviteNotify, diff --git a/pounce.1 b/pounce.1 index 58a0532..ef28279 100644 --- a/pounce.1 +++ b/pounce.1 @@ -1,4 +1,4 @@ -.Dd February 26, 2020 +.Dd February 27, 2020 .Dt POUNCE 1 .Os . @@ -341,6 +341,7 @@ is supported: .Sy account-tag , .Sy away-notify , .Sy batch , +.Sy cap-notify , .Sy chghost , .Sy extended-join , .Sy invite-notify , 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]); } |