# HG changeset patch # User Ralph Meijer # Date 1099674882 0 # Node ID 55fa890ef60b8a474eaf1cb67a3d870d81b61870 # Parent 7c4dfef5d964ac73a29f7c0796d1141ae39b923d Match backend's supported_*() methods in getFeatures() of ComponentServiceFromService. Add getFeatures() to ComponentServiceFromNodeCreationService. Fix small error in ComponentServiceFromNodeCreationService to handle not specifying the node attribute. diff -r 7c4dfef5d964 -r 55fa890ef60b idavoll/pubsub.py --- a/idavoll/pubsub.py Fri Nov 05 17:06:08 2004 +0000 +++ b/idavoll/pubsub.py Fri Nov 05 17:14:42 2004 +0000 @@ -125,14 +125,15 @@ def getFeatures(self, node): features = [] - affiliations = self.backend.get_supported_affiliations() - if 'outcast' in affiliations: - features.append("http://jabber.org/protocol/pubsub#outcast-affil") + if not node: + if self.backend.supports_publisher_affiliation(): + features.append(NS_PUBSUB + "#publisher-affiliation") - if 'publisher' in affiliations: - features.append("http://jabber.org/protocol/pubsub#publisher-affil") + if self.backend.supports_outcast_affiliation(): + features.append(NS_PUBSUB + "#outcast-affiliation") - # "http://jabber.org/protocol/pubsub#persistent-items" + if self.backend.supports_persistent_items(): + features.append(NS_PUBSUB + "#persistent-items") return features @@ -253,6 +254,17 @@ class ComponentServiceFromNodeCreationService(Service): + def getFeatures(self, node): + features = [] + + if not node: + features.append(NS_PUBSUB + "#create-nodes") + + if self.backend.supports_instant_nodes(): + features.append(NS_PUBSUB + "#instant-nodes") + + return features + def componentConnected(self, xmlstream): xmlstream.addObserver(PUBSUB_CREATE, self.onCreate) xmlstream.addObserver(PUBSUB_CONFIGURE_GET, self.onConfigureGet) @@ -265,7 +277,8 @@ if iq.pubsub.options: raise CreateNodeNotConfigurable - node = iq.pubsub.create["node"] + node = iq.pubsub.create.getAttribute("node") + owner = jid.JID(iq["from"]).userhostJID() d = self.backend.create_node(node, owner)