draft/message-tags-0.3 (JSON tags) was rejected

This commit is contained in:
jesopo 2019-02-20 14:46:40 +00:00
parent 807021ecc4
commit 81d82413d4
2 changed files with 8 additions and 13 deletions

View file

@ -6,9 +6,8 @@ RE_MODES = re.compile(r"[-+]\w+")
CAPABILITIES = {"multi-prefix", "chghost", "invite-notify", "account-tag", CAPABILITIES = {"multi-prefix", "chghost", "invite-notify", "account-tag",
"account-notify", "extended-join", "away-notify", "userhost-in-names", "account-notify", "extended-join", "away-notify", "userhost-in-names",
"draft/message-tags-0.2", "draft/message-tags-0.3", "server-time", "draft/message-tags-0.2", "server-time", "cap-notify", "batch",
"cap-notify", "batch", "draft/labeled-response", "draft/rename", "draft/labeled-response", "draft/rename", "echo-message", "draft/setname"}
"echo-message", "draft/setname"}
LABELED_BATCH = { LABELED_BATCH = {
"labeled-response": "label", "labeled-response": "label",

View file

@ -116,16 +116,12 @@ def parse_line(line: str) -> IRCParsedLine:
if line[0] == "@": if line[0] == "@":
tags_prefix, line = line[1:].split(" ", 1) tags_prefix, line = line[1:].split(" ", 1)
if tags_prefix[0] == "{": for tag in filter(None, tags_prefix.split(";")):
tags_prefix = message_tag_unescape(tags_prefix) tag, sep, value = tag.partition("=")
tags = json.loads(tags_prefix) if sep:
else: tags[tag] = message_tag_unescape(value)
for tag in filter(None, tags_prefix.split(";")): else:
tag, sep, value = tag.partition("=") tags[tag] = None
if sep:
tags[tag] = message_tag_unescape(value)
else:
tags[tag] = None
line, trailing_separator, trailing_split = line.partition(" :") line, trailing_separator, trailing_split = line.partition(" :")