summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--handle.c11
1 files changed, 8 insertions, 3 deletions
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);
+	}
 }