changeset 453:1a179ad10125

backend: service name can now be specified with `service_name` parameter
author Goffi <goffi@goffi.org>
date Fri, 02 Jul 2021 15:39:57 +0200
parents 8da3db1e82a9
children 7f1394bb96db
files CHANGELOG sat_pubsub/backend.py sat_pubsub/const.py twisted/plugins/pubsub.py
diffstat 4 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Fri Jul 02 15:18:09 2021 +0200
+++ b/CHANGELOG	Fri Jul 02 15:39:57 2021 +0200
@@ -1,11 +1,12 @@
 v 0.4.0 (NOT RELEASED YET):
-	- /!\ renamed to "Libervia Pubsub", application name is now "libervia-pubsub"
+    - /!\ renamed to "Libervia Pubsub", application name is now "libervia-pubsub"
     - Python 3 port
     - publish-options implementation
     - max_items configuration option
     - Full-Text Search, with node setting to specify language
     - XEP-0346 (Form Discovery and Publishing) implementation (replacing the non standard node schema)
     - environment variables can now be used to set options
+    - service name can now be specified with "service_name" parameter
     - bug fixes
 
 v 0.3.0 (16/08/2019)
--- a/sat_pubsub/backend.py	Fri Jul 02 15:18:09 2021 +0200
+++ b/sat_pubsub/backend.py	Fri Jul 02 15:39:57 2021 +0200
@@ -1335,7 +1335,7 @@
 
     discoIdentity = disco.DiscoIdentity('pubsub',
                                         'service',
-                                        'Salut à Toi pubsub service')
+                                        const.SERVICE_NAME)
 
     pubsubService = None
 
@@ -1372,6 +1372,8 @@
         self.backend = backend
         self.hideNodes = False
 
+        self.__class__.discoIdentity.name = backend.config["service_name"]
+
         self.backend.registerPublishNotifier(self._notifyPublish)
         self.backend.registerRetractNotifier(self._notifyRetract)
         self.backend.registerPreDelete(self._preDelete)
--- a/sat_pubsub/const.py	Fri Jul 02 15:18:09 2021 +0200
+++ b/sat_pubsub/const.py	Fri Jul 02 15:39:57 2021 +0200
@@ -51,6 +51,7 @@
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
+SERVICE_NAME = 'Libervia Pubsub Service'
 NS_CLIENT = 'jabber:client'
 NS_GROUPBLOG_PREFIX = 'urn:xmpp:groupblog:'
 NS_ITEM_CONFIG = "http://jabber.org/protocol/pubsub#item-config"
--- a/twisted/plugins/pubsub.py	Fri Jul 02 15:18:09 2021 +0200
+++ b/twisted/plugins/pubsub.py	Fri Jul 02 15:39:57 2021 +0200
@@ -61,6 +61,7 @@
 from twisted.plugin import IPlugin
 from twisted.words.protocols.jabber.jid import JID
 import sat_pubsub
+from sat_pubsub import const
 
 
 
@@ -90,6 +91,7 @@
     ['db_pass', None, None, 'Database password (pgsql backend)'],
     ['db_host', None, None, 'Database host (pgsql backend)'],
     ['db_port', None, None, 'Database port (pgsql backend)'],
+    ['service_name', None, const.SERVICE_NAME, 'Name of this Pubsub service'],
     ]
 
 OPT_PARAMETERS_CFG = [
@@ -216,7 +218,6 @@
         from wokkel import pubsub
         from wokkel import rsm
         from wokkel import mam
-        from sat_pubsub import const
         from sat_pubsub import mam as pubsub_mam
         from sat_pubsub import pubsub_admin
         from sat_pubsub.backend import BackendService, ExtraDiscoHandler