From 8570a62235e5e9b6a6d719fd8b92cedc91a1d511 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Sat, 29 Feb 2020 01:03:46 -0500 Subject: Implement the causal.agency/consumer capability --- handle.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'handle.c') diff --git a/handle.c b/handle.c index 58fdce2..0a1dedb 100644 --- a/handle.c +++ b/handle.c @@ -126,6 +126,10 @@ static void handleCap(struct Message *msg) { enum Cap caps = capParse(msg->params[2]); if (!strcmp(msg->params[1], "LS")) { caps &= ~CapSASL; + if (caps & CapConsumer && self.pos) { + ircFormat("CAP REQ %s=%zu\r\n", CapNames[CapConsumerBit], self.pos); + caps &= ~CapConsumer; + } if (caps) { ircFormat("CAP REQ :%s\r\n", capList(caps)); } else { @@ -1019,9 +1023,10 @@ void handle(struct Message msg) { ); if (handler) { handler->fn(&msg); - return; - } - if (strcmp(msg.cmd, "400") >= 0 && strcmp(msg.cmd, "599") <= 0) { + } else if (strcmp(msg.cmd, "400") >= 0 && strcmp(msg.cmd, "599") <= 0) { handleErrorGeneric(&msg); } + if (msg.tags[TagPos]) { + self.pos = strtoull(msg.tags[TagPos], NULL, 10); + } } -- cgit 1.4.1-2-gfad0