comparison idavoll/idavoll.py @ 57:445a61f872b6

Use NodeCreationService for pgsql backend, too. Fix onDiscoInfo().
author Ralph Meijer <ralphm@ik.nu>
date Fri, 05 Nov 2004 17:15:50 +0000
parents 0947b46c0968
children 60e95c60252d
comparison
equal deleted inserted replaced
56:55fa890ef60b 57:445a61f872b6
27 xmlstream.addObserver(DISCO_ITEMS, self.onDiscoItems, 1) 27 xmlstream.addObserver(DISCO_ITEMS, self.onDiscoItems, 1)
28 xmlstream.addObserver(IQ_GET, self.iqFallback, -1) 28 xmlstream.addObserver(IQ_GET, self.iqFallback, -1)
29 xmlstream.addObserver(IQ_SET, self.iqFallback, -1) 29 xmlstream.addObserver(IQ_SET, self.iqFallback, -1)
30 30
31 def getFeatures(self, node): 31 def getFeatures(self, node):
32 features = []
33
32 if not node: 34 if not node:
33 return [NS_DISCO_ITEMS, NS_VERSION] 35 features.extend([NS_DISCO_ITEMS, NS_VERSION])
36
37 return features
34 38
35 def onVersion(self, iq): 39 def onVersion(self, iq):
36 iq.swapAttributeValues("to", "from") 40 iq.swapAttributeValues("to", "from")
37 iq["type"] = "result" 41 iq["type"] = "result"
38 name = iq.addElement("name", None, 'Idavoll') 42 name = iq.addElement("name", None, 'Idavoll')
50 if hasattr(c, "getIdentities"): 54 if hasattr(c, "getIdentities"):
51 identities.extend(c.getIdentities(node)) 55 identities.extend(c.getIdentities(node))
52 if hasattr(c, "getFeatures"): 56 if hasattr(c, "getFeatures"):
53 features.extend(c.getFeatures(node)) 57 features.extend(c.getFeatures(node))
54 58
55 if not features and not identities and not node: 59 if node and not features and not identities:
56 xmpp_error.error_from_iq(iq, 'item-not-found') 60 xmpp_error.error_from_iq(iq, 'item-not-found')
57 else: 61 else:
58 iq.swapAttributeValues("to", "from") 62 iq.swapAttributeValues("to", "from")
59 iq["type"] = "result" 63 iq["type"] = "result"
60 for identity in identities: 64 for identity in identities:
108 112
109 bsc = b.SubscriptionService() 113 bsc = b.SubscriptionService()
110 bsc.setServiceParent(bs) 114 bsc.setServiceParent(bs)
111 component.IService(bsc).setServiceParent(sm) 115 component.IService(bsc).setServiceParent(sm)
112 116
113 if config['backend'] == 'memory': 117 bsc = b.NodeCreationService()
114 bsc = b.NodeCreationService() 118 bsc.setServiceParent(bs)
115 bsc.setServiceParent(bs) 119 component.IService(bsc).setServiceParent(sm)
116 component.IService(bsc).setServiceParent(sm)
117 120
118 s = IdavollService() 121 s = IdavollService()
119 s.setServiceParent(sm) 122 s.setServiceParent(sm)
120 123
121 sm.setServiceParent(serviceCollection) 124 sm.setServiceParent(serviceCollection)