mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Interpret empty server tag values as missing tag values.
As required by https://ircv3.net/specs/extensions/message-tags
This commit is contained in:
parent
88524beada
commit
f143e977d6
@ -73,7 +73,12 @@ def parse_server_tags(s):
|
||||
server_tags[tag] = None
|
||||
else:
|
||||
(key, value) = tag.split('=', 1)
|
||||
server_tags[key] = unescape_server_tag_value(value)
|
||||
value = unescape_server_tag_value(value)
|
||||
if value == '':
|
||||
# "Implementations MUST interpret empty tag values (e.g. foo=)
|
||||
# as equivalent to missing tag values (e.g. foo)."
|
||||
value = None
|
||||
server_tags[key] = value
|
||||
return server_tags
|
||||
def format_server_tags(server_tags):
|
||||
parts = []
|
||||
|
@ -147,6 +147,14 @@ class IrcMsgTestCase(SupyTestCase):
|
||||
self.assertEqual(m.args, ('me', 'Hello'))
|
||||
self.assertEqual(str(m), s + '\n')
|
||||
|
||||
s = '@foo=;bar=baz;qux= ' \
|
||||
':nick!ident@host.com PRIVMSG me :Hello'
|
||||
m = ircmsgs.IrcMsg(s)
|
||||
self.assertEqual(m.server_tags, {
|
||||
'foo': None,
|
||||
'bar': 'baz',
|
||||
'qux': None})
|
||||
|
||||
def testTime(self):
|
||||
before = time.time()
|
||||
msg = ircmsgs.IrcMsg('PRIVMSG #foo :foo')
|
||||
|
Loading…
Reference in New Issue
Block a user