Beispiel #1
0
    def status(self, code, reason, *flags):
        """
        Set the status code.
        """

        log.msg("%% Status: %s (%d) %r" % (reason, code, flags))
        if flags:
            status = "ISTA %d %s %s" % (code, " ".join(flags), escape(reason))
        else:
            status = "ISTA %d %s" % (code, escape(reason))
        self.sendLine(status)
Beispiel #2
0
    def chat(self, sender, message):
        """
        Send a message.
        """

        msg = "BMSG %s %s" % (sender, escape(message))
        self.sendLine(msg)
Beispiel #3
0
    def kick(self, reason):
        """
        Disconnect this client.
        """

        log.msg("Kicking %s: %s" % (self.sid, reason))

        message = "%s MS%s" % (self.sid, escape(reason))
        self.factory.broadcast("QUI", message)
        self.transport.loseConnection()
 def test_escape_ordering(self):
     i = "\\s"
     o = "\\\\s"
     self.assertEqual(escape(i), o)
 def test_escape_space(self):
     i = "test escape"
     o = "test\\sescape"
     self.assertEqual(escape(i), o)
 def test_escape_ordering(self):
     i = "\\s"
     o = "\\\\s"
     self.assertEqual(escape(i), o)
 def test_escape_space(self):
     i = "test escape"
     o = "test\\sescape"
     self.assertEqual(escape(i), o)