Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0060.py @ 1261:93bce9e4c9c8
plugin XEP-0060: listNodes should not use SatPubSubClient.getDiscoItems but self.host.getDiscoItems, cf. revs 1217 (318eab3f93f8) and 1259 (633fcd13a7dc)
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 24 Nov 2014 17:20:51 +0100 |
parents | c8cf61c6d238 |
children | ea692d51a0ee faa1129559b8 |
comparison
equal
deleted
inserted
replaced
1260:c8cf61c6d238 | 1261:93bce9e4c9c8 |
---|---|
127 @param nodeIdentifier (str): the parent node name (leave empty to retrieve first-level nodes) | 127 @param nodeIdentifier (str): the parent node name (leave empty to retrieve first-level nodes) |
128 @param profile (str): %(doc_profile)s | 128 @param profile (str): %(doc_profile)s |
129 @return: Deferred list[str] | 129 @return: Deferred list[str] |
130 """ | 130 """ |
131 session_id = profile + '@found@' + service.userhost() | 131 session_id = profile + '@found@' + service.userhost() |
132 d = self.getDiscoItems(service, nodeIdentifier, profile_key=profile) | 132 d = self.host.getDiscoItems(service, nodeIdentifier, profile_key=profile) |
133 d.addCallback(lambda result: [item.getAttribute('node') for item in result.toElement().children if item.hasAttribute('node')]) | 133 d.addCallback(lambda result: [item.getAttribute('node') for item in result.toElement().children if item.hasAttribute('node')]) |
134 return self._getDeferredNodeCache(session_id, d, profile) | 134 return self._getDeferredNodeCache(session_id, d, profile) |
135 | 135 |
136 def listSubscribedNodes(self, service, nodeIdentifier='', filter_='subscribed', profile=C.PROF_KEY_NONE): | 136 def listSubscribedNodes(self, service, nodeIdentifier='', filter_='subscribed', profile=C.PROF_KEY_NONE): |
137 """Retrieve the name of the nodes to which the profile is subscribed on the target service. | 137 """Retrieve the name of the nodes to which the profile is subscribed on the target service. |
229 | 229 |
230 def subscriptions(self, service, nodeIdentifier='', profile_key=C.PROF_KEY_NONE): | 230 def subscriptions(self, service, nodeIdentifier='', profile_key=C.PROF_KEY_NONE): |
231 profile, client = self.__getClientNProfile(profile_key, 'retrieve subscriptions') | 231 profile, client = self.__getClientNProfile(profile_key, 'retrieve subscriptions') |
232 return client.subscriptions(service, nodeIdentifier) | 232 return client.subscriptions(service, nodeIdentifier) |
233 | 233 |
234 def getDiscoItems(self, service, nodeIdentifier='', profile_key=C.PROF_KEY_NONE): | |
235 profile, client = self.__getClientNProfile(profile_key, 'disco items') | |
236 return client.getDiscoItems(None, service, nodeIdentifier) | |
237 | |
238 | 234 |
239 class SatPubSubClient(pubsub.PubSubClient): | 235 class SatPubSubClient(pubsub.PubSubClient): |
240 implements(disco.IDisco) | 236 implements(disco.IDisco) |
241 | 237 |
242 def __init__(self, host, parent_plugin): | 238 def __init__(self, host, parent_plugin): |