diff -r a0bcf2e586ec doc/examples/client_service.tac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/examples/client_service.tac Fri Feb 12 09:50:08 2010 +0100 @@ -0,0 +1,40 @@ +from twisted.application import service +from twisted.internet import defer + +from wokkel.client import ClientService +from wokkel.generic import FallbackHandler +from wokkel.xmppim import RosterProtocol + +import socket +domain = socket.gethostname() + +class StaticRoster(RosterProtocol): + + def __init__(self): + self.roster = {'ralphm': + [{'jid': 'intosi@' + domain, + 'name': 'Intosi', + 'subscription': 'both', + 'ask': None, + 'groups': ['Friends'] + }, + {'jid': 'termie@' + domain, + 'name': 'termie', + 'subscription': 'both', + 'ask': None, + 'groups': [] + }], + 'test': + [ + ]} + + def getRoster(self, entity): + return defer.succeed(self.roster[entity.user]) + + +application = service.Application("Jabber server") +clientService = ClientService(domain, 5224) +clientService.logTraffic = True +clientService.addHandler(FallbackHandler()) +clientService.addHandler(StaticRoster()) +clientService.setServiceParent(application)