changeset 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 4841ad6a5db4
children feaacc462fef
files src/plugins/plugin_xep_0060.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0060.py	Tue Dec 12 00:12:44 2017 +0100
+++ b/src/plugins/plugin_xep_0060.py	Tue Dec 12 01:07:25 2017 +0100
@@ -121,7 +121,11 @@
     @defer.inlineCallbacks
     def profileConnected(self, client):
         client.pubsub_watching = set()
-        client.pubsub_service = yield self.host.findServiceEntity(client, "pubsub", "service")
+        try:
+            client.pubsub_service = jid.JID(self.host.memory.getConfig('', 'pubsub_service'))
+        except RuntimeError:
+            log.info(_(u"Can't retrieve pubsub_service from conf, we'll use first one that we find"))
+            client.pubsub_service = yield self.host.findServiceEntity(client, "pubsub", "service")
 
     def getFeatures(self, profile):
         try: