示例#1
0
def test_channel_get_function(c):
    chan = Channel('#test')
    assert c.channels == []

    c.me.channels.append(chan)
    assert c.channels == [chan]

    assert Channel.get('#test', c) is chan
    assert Channel.get('#test2', c) is None

    match = Match(None, None, c)
    assert Channel.get('#test', match) is chan
示例#2
0
def test_channel_get_function(c):
    chan = Channel('#test')
    assert c.channels == []

    c.me.channels.append(chan)
    assert c.channels == [chan]

    assert Channel.get('#test', c) is chan
    assert Channel.get('#test2', c) is None

    match = Match(None, None, c)
    assert Channel.get('#test', match) is chan
示例#3
0
def names(match):
    chan = Channel.get(match.line[4], match)

    if not chan:
        chan = Channel(match.line[4])

    for nick in match.line[5:]:
        nick = nick.lstrip(':!~&@%+')
        user = User.get(nick, match)

        if not user:
            user = User(nick)

        chan.users.append(user)
        user.channels.append(chan)

        if not user.auth:
            match.connection.write('WHOIS {}'.format(nick))
示例#4
0
文件: track.py 项目: Sebbe/Pyromancer
def who_entry(match):
    user = User.get(match.line[7], match)

    if user.host is None:
        # User is new to us, so let's set info we know
        user.host = match.line[5]

    chan = Channel.get(match.line[3], match)
    if user not in chan.users:
        chan.users.append(user)

    if chan not in user.channels:
        user.channels.append(chan)