Prev | Index | Next

Server implementation

from twisted.internet import protocol, reactor
from twisted.protocols import basic

class Presence(basic.LineReceiver):
    def connectionMade(self):
        self.state = 'needlogin'
    def lineReceived(self, line):
        cmd, data = line.split(" ", 1)
        f = getattr(self, 'handle_%s' % cmd)
        f(data)
    ...