source:
ralphm-patches/client_service_example.patch
@
35:2866eaae775f
Last change on this file since 35:2866eaae775f was 35:2866eaae775f, checked in by Ralph Meijer <ralphm@…>, 11 years ago | |
---|---|
File size: 1.6 KB |
-
new file doc/examples/client_service.tac
diff -r 0a3d1655a3e5 doc/examples/client_service.tac
- + 1 from twisted.application import service 2 from twisted.internet import defer 3 4 from wokkel.client import ClientService 5 from wokkel.generic import FallbackHandler 6 from wokkel.xmppim import RosterServerProtocol 7 8 import socket 9 domain = socket.gethostname() 10 11 class StaticRoster(RosterServerProtocol): 12 13 def __init__(self): 14 RosterServerProtocol.__init__(self) 15 self.roster = {'ralphm': 16 [{'jid': 'intosi@' + domain, 17 'name': 'Intosi', 18 'subscription': 'both', 19 'ask': None, 20 'groups': ['Friends'] 21 }, 22 {'jid': 'termie@' + domain, 23 'name': 'termie', 24 'subscription': 'both', 25 'ask': None, 26 'groups': [] 27 }], 28 'test': 29 [ 30 ]} 31 32 def getRoster(self, entity): 33 return defer.succeed(self.roster[entity.user]) 34 35 36 application = service.Application("Jabber server") 37 clientService = ClientService(domain, 5224) 38 clientService.logTraffic = True 39 FallbackHandler().setHandlerParent(clientService) 40 StaticRoster().setHandlerParent(clientService) 41 clientService.setServiceParent(application)
Note: See TracBrowser
for help on using the repository browser.