Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0060.py @ 2459:a9c092bf4ee9
plugin XEP-0060: added an config option to set pubsub service
"pubsub_service" can now be used in [DEFAULT] section. If not found or invalid, first pubsub service found will be used
fix 216
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 12 Dec 2017 01:07:25 +0100 |
parents | 30278ea1ca7c |
children | 0046283a285d |
comparison
equal
deleted
inserted
replaced
2458:4841ad6a5db4 | 2459:a9c092bf4ee9 |
---|---|
119 return client.pubsub_client | 119 return client.pubsub_client |
120 | 120 |
121 @defer.inlineCallbacks | 121 @defer.inlineCallbacks |
122 def profileConnected(self, client): | 122 def profileConnected(self, client): |
123 client.pubsub_watching = set() | 123 client.pubsub_watching = set() |
124 client.pubsub_service = yield self.host.findServiceEntity(client, "pubsub", "service") | 124 try: |
125 client.pubsub_service = jid.JID(self.host.memory.getConfig('', 'pubsub_service')) | |
126 except RuntimeError: | |
127 log.info(_(u"Can't retrieve pubsub_service from conf, we'll use first one that we find")) | |
128 client.pubsub_service = yield self.host.findServiceEntity(client, "pubsub", "service") | |
125 | 129 |
126 def getFeatures(self, profile): | 130 def getFeatures(self, profile): |
127 try: | 131 try: |
128 client = self.host.getClient(profile) | 132 client = self.host.getClient(profile) |
129 except exceptions.ProfileNotSetError: | 133 except exceptions.ProfileNotSetError: |