Example #1
0
File: irc.py Project: kirkeby/flexo
 def parse_line(self, line):
     prefix, command, parameters = parse_message(line)
     return Message(self, prefix, command, parameters)
Example #2
0
def test_parse_without_trailing():
    assert parse_message(':localhost 001 Welcome.') \
           == ['localhost', '001', ['Welcome.']]
    assert parse_message(':localhost FURRFU abc:def') \
           == ['localhost', 'FURRFU', ['abc:def']]
Example #3
0
def test_parse_with_trailing():
    assert parse_message(':localhost PRIVMSG #cafeen :!lart Bender') \
           == ['localhost', 'PRIVMSG', ['#cafeen', '!lart Bender']]
    assert parse_message(':localhost KICK #cafeen kirkeby : Uuuuuud!') \
           == ['localhost', 'KICK', ['#cafeen', 'kirkeby', ' Uuuuuud!']]
Example #4
0
def test_parse_prefixless():
    assert parse_message('PING 42') \
           == [None, 'PING', ['42']]
    assert parse_message('ERROR :Closing connection') \
           == [None, 'ERROR', ['Closing connection']]