From 98b82c7f2cf628393a68b028174d1160f39fe632 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 11 Feb 2019 22:19:20 +0000 Subject: Insert `label` tag to lines in labeled BATCHes (line_handler.py) --- modules/line_handler.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'modules/line_handler.py') diff --git a/modules/line_handler.py b/modules/line_handler.py index 8b1dbf90..3f6c880c 100644 --- a/modules/line_handler.py +++ b/modules/line_handler.py @@ -8,7 +8,11 @@ CAPABILITIES = {"multi-prefix", "chghost", "invite-notify", "account-tag", "account-notify", "extended-join", "away-notify", "userhost-in-names", "draft/message-tags-0.2", "draft/message-tags-0.3", "server-time", "cap-notify", "batch", "draft/labeled-response", "draft/rename"} -LABELED_BATCH = ["draft/labeled-response", "labeled-response"] + +LABELED_BATCH = { + "labeled-response": "label", + "draft/labeled-response": "draft/label" +} class Direction(enum.Enum): SEND = 0 @@ -563,7 +567,15 @@ class Module(ModuleManager.BaseModule): else: batch = event["server"].batches[identifier] del event["server"].batches[identifier] + + add_tags = {} + if batch.type in LABELED_BATCH.keys(): + tag_name = LABELED_BATCH[batch.type] + add_tags[tag_name] = batch.tags[tag_name] + for line in batch.lines: + if add_tags: + line.tags.update(add_tags) self._handle(line) # IRCv3 CHGHOST, a user's username and/or hostname has changed -- cgit v1.3.1-10-gc9f91