From 8b497af30b899b1e724b7eeeacd8b85a9f32e457 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 4 Mar 2021 18:48:15 +0100 Subject: [PATCH] Services: Add support for REGISTER responses in nested batches. --- plugins/Services/plugin.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/Services/plugin.py b/plugins/Services/plugin.py index 12270464a..b0b99ae18 100644 --- a/plugins/Services/plugin.py +++ b/plugins/Services/plugin.py @@ -668,12 +668,22 @@ class Services(callbacks.Plugin): ) return - if "batch" in msg.server_tags: - # TODO: handle recursive batches - batch = irc.state.batches[msg.server_tags["batch"]] - label = batch.messages[0].server_tags["label"] - else: - label = msg.server_tags["label"] + label = msg.server_tags.get("label") + + if not label and "batch" in msg.server_tags: + for batch in irc.state.getParentBatches(msg): + label = batch.messages[0].server_tags.get("label") + if label: + break + + if not label: + self.log.error( + "Got '%s' on %s, but it is missing a label. " + "This is a bug, please report it.", + command, irc.network + ) + return + if label not in self._register: self.log.warning( "Got '%s' on %s, but I don't remember using "