示例#1
0
    assert host == "localhost"

    s = "test"
    nick, ident, host = parseprefix(s)
    assert nick == "test"
    assert ident is None
    assert host is None


@pytest.mark.parametrize("event,data", [
    (PASS("secret"), b"PASS secret\r\n"),
    (USER("foo", "localhost", "localhost",
          "Test Client"), b"USER foo localhost localhost :Test Client\r\n"),
    (NICK("test"), b"NICK test\r\n"),
    (PONG("localhost"), b"PONG :localhost\r\n"),
    (QUIT(), b"QUIT Leaving\r\n"),
    (QUIT("Test"), b"QUIT Test\r\n"),
    (QUIT("Test Message"), b"QUIT :Test Message\r\n"),
    (JOIN("#test"), b"JOIN #test\r\n"),
    (JOIN("#test", "secret"), b"JOIN #test secret\r\n"),
    (PART("#test"), b"PART #test\r\n"),
    (PRIVMSG("test", "Hello"), b"PRIVMSG test Hello\r\n"),
    (PRIVMSG("test", "Hello World"), b"PRIVMSG test :Hello World\r\n"),
    (NOTICE("test", "Hello"), b"NOTICE test Hello\r\n"),
    (NOTICE("test", "Hello World"), b"NOTICE test :Hello World\r\n"),
    (KICK("#test", "test"), b"KICK #test test :\r\n"),
    (KICK("#test", "test", "Bye"), b"KICK #test test Bye\r\n"),
    (KICK("#test", "test", "Good Bye!"), b"KICK #test test :Good Bye!\r\n"),
    (TOPIC("#test", "Hello World!"), b"TOPIC #test :Hello World!\r\n"),
    (MODE("+i"), b"MODE +i\r\n"),
    (MODE("#test", "+o", "test"), b"MODE #test +o test\r\n"),
示例#2
0
 def signal(self, event, signo, stack):
     if signo == signal.SIGINT:
         for client in self.servers.values():
             client.fire(QUIT('Keyboard interrupt'))
示例#3
0
 def remove_server(self, server, message='Leaving!'):
     for client in self.servers.values():
         if client.channel == server:
             client.fire(QUIT(message))
             return client
示例#4
0
 def __call__(self, args):
     self._commander.fire(QUIT(' '.join(args.message)),
                          args.ircserver.channel)
     return 'Okay, going to exit!'
示例#5
0
 def cmdQUIT(self, message="Bye"):
     self.fire(QUIT(message))
示例#6
0
 def cmdEXIT(self, message=""):
     self.fire(QUIT(message))
     raise SystemExit(0)