comparison idavoll/tap.py @ 176:17fc5dd77158

Move around service setup.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 09 Apr 2008 13:15:39 +0000
parents 958e69630e52
children faf1c9bc2612
comparison
equal deleted inserted replaced
175:bd86f0c3fd39 176:17fc5dd77158
38 raise usage.UsageError, "Unknown backend!" 38 raise usage.UsageError, "Unknown backend!"
39 39
40 def makeService(config): 40 def makeService(config):
41 s = service.MultiService() 41 s = service.MultiService()
42 42
43 cs = Component(config["rhost"], int(config["rport"]), 43 # Create backend service with storage
44 config["jid"], config["secret"])
45 cs.setServiceParent(s)
46
47 cs.factory.maxDelay = 900
48
49 if config["verbose"]:
50 cs.logTraffic = True
51
52 FallbackHandler().setHandlerParent(cs)
53 VersionHandler('Idavoll', __version__).setHandlerParent(cs)
54 DiscoHandler().setHandlerParent(cs)
55 44
56 if config['backend'] == 'pgsql': 45 if config['backend'] == 'pgsql':
57 from idavoll.pgsql_storage import Storage 46 from idavoll.pgsql_storage import Storage
58 st = Storage(user=config['dbuser'], 47 st = Storage(user=config['dbuser'],
59 database=config['dbname'], 48 database=config['dbname'],
65 st = Storage() 54 st = Storage()
66 55
67 bs = BackendService(st) 56 bs = BackendService(st)
68 bs.setServiceParent(s) 57 bs.setServiceParent(s)
69 58
59 # Set up XMPP server-side component with publish-subscribe capabilities
60
61 cs = Component(config["rhost"], int(config["rport"]),
62 config["jid"], config["secret"])
63 cs.setServiceParent(s)
64
65 cs.factory.maxDelay = 900
66
67 if config["verbose"]:
68 cs.logTraffic = True
69
70 FallbackHandler().setHandlerParent(cs)
71 VersionHandler('Idavoll', __version__).setHandlerParent(cs)
72 DiscoHandler().setHandlerParent(cs)
73
70 ps = IPubSubService(bs) 74 ps = IPubSubService(bs)
71 ps.setHandlerParent(cs) 75 ps.setHandlerParent(cs)
72 ps.hideNodes = config["hide-nodes"] 76 ps.hideNodes = config["hide-nodes"]
73 ps.serviceJID = JID(config["jid"]) 77 ps.serviceJID = JID(config["jid"])
74 78