comparison src/plugins/plugin_xep_0060.py @ 2432:c6d859df4b27

plugin XEP-0060: use new findServiceEntity to get default pubsub service
author Goffi <goffi@goffi.org>
date Wed, 15 Nov 2017 08:55:47 +0100
parents e3edbccd26d7
children b8ffb7f8056b
comparison
equal deleted inserted replaced
2431:a9fac72825a2 2432:c6d859df4b27
111 client.pubsub_client = SatPubSubClient(self.host, self) 111 client.pubsub_client = SatPubSubClient(self.host, self)
112 return client.pubsub_client 112 return client.pubsub_client
113 113
114 @defer.inlineCallbacks 114 @defer.inlineCallbacks
115 def profileConnected(self, client): 115 def profileConnected(self, client):
116 pubsub_services = yield self.host.findServiceEntities(client, "pubsub", "service") 116 client.pubsub_service = yield self.host.findServiceEntity(client, "pubsub", "service")
117 if pubsub_services:
118 # we use one of the found services as our default pubsub service
119 client.pubsub_service = pubsub_services.pop()
120 else:
121 client.pubsub_service = None
122 117
123 def getFeatures(self, profile): 118 def getFeatures(self, profile):
124 try: 119 try:
125 client = self.host.getClient(profile) 120 client = self.host.getClient(profile)
126 except exceptions.ProfileNotSetError: 121 except exceptions.ProfileNotSetError: