diff options
| author | 2018-11-05 15:15:08 +0000 | |
|---|---|---|
| committer | 2018-11-05 15:15:08 +0000 | |
| commit | 4936b912732a6db9ec2ce761da986d2c71cf28ce (patch) | |
| tree | bf6524e2b2c1a2d8030c308c1a302dc237b2fc47 /src/utils | |
| parent | TRACE log when we set an STS policy (diff) | |
| signature | ||
Support JSON messages tags, as per IRCv'3 message-tags-0.3 #318 pull request
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/irc.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/utils/irc.py b/src/utils/irc.py index c22cfd25..f68af6ec 100644 --- a/src/utils/irc.py +++ b/src/utils/irc.py @@ -83,10 +83,16 @@ def parse_line(line: str) -> IRCLine: command = None if line[0] == "@": - tags_prefix, line = line[1:].split(" ", 1) - for tag in filter(None, tags_prefix.split(";")): - tag, _, value = tag.partition("=") - tags[tag] = value + if line[1] == "{": + tags = json.loads(line[2:]) + else: + tags_prefix, line = line[1:].split(" ", 1) + for tag in filter(None, tags_prefix.split(";")): + tag, sep, value = tag.partition("=") + if sep: + tags[tag] = value + else: + tags[tag] = None line, _, arbitrary_split = line.partition(" :") arbitrary = arbitrary_split or None |
