changeset 3143:830fce0db15d

bridge (dbus): new `bridge_dbus_int_prefix` option (in `[DEFAULT]` settings) to change interface prefix
author Goffi <goffi@goffi.org>
date Wed, 29 Jan 2020 18:54:40 +0100
parents cd90c24b2836
children 02325c3141dd
files sat/bridge/bridge_constructor/constructors/dbus/dbus_core_template.py sat/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py sat/bridge/dbus_bridge.py sat_frontends/bridge/dbus_bridge.py
diffstat 4 files changed, 42 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/sat/bridge/bridge_constructor/constructors/dbus/dbus_core_template.py	Wed Jan 29 18:31:47 2020 +0100
+++ b/sat/bridge/bridge_constructor/constructors/dbus/dbus_core_template.py	Wed Jan 29 18:54:40 2020 +0100
@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
 
-
-# SAT: a jabber client
+# SàT communication bridge
 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
 
 # This program is free software: you can redistribute it and/or modify
@@ -23,12 +22,19 @@
 import dbus.mainloop.glib
 import inspect
 from sat.core.log import getLogger
-
-log = getLogger(__name__)
+from sat.tools import config
 from twisted.internet.defer import Deferred
 from sat.core.exceptions import BridgeInitError
 
-const_INT_PREFIX = "org.salutatoi.SAT"  # Interface prefix
+
+log = getLogger(__name__)
+
+# Interface prefix
+const_INT_PREFIX = config.getConfig(
+    config.parseMainConf(),
+    "",
+    "bridge_dbus_int_prefix",
+    "org.salutatoi.SAT")
 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
 const_OBJ_PATH = "/org/salutatoi/SAT/bridge"
 const_CORE_SUFFIX = ".core"
--- a/sat/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py	Wed Jan 29 18:31:47 2020 +0100
+++ b/sat/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py	Wed Jan 29 18:54:40 2020 +0100
@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
-#-*- coding: utf-8 -*-
 
-# SAT communication bridge
+# SàT communication bridge
 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
 
 # This program is free software: you can redistribute it and/or modify
@@ -21,16 +20,23 @@
 import dbus
 import ast
 from sat.core.i18n import _
-from .bridge_frontend import BridgeException
+from sat.tools import config
 from sat.core.log import getLogger
 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError
 from dbus.mainloop.glib import DBusGMainLoop
+from .bridge_frontend import BridgeException
+
 
 DBusGMainLoop(set_as_default=True)
 log = getLogger(__name__)
 
 
-const_INT_PREFIX = "org.salutatoi.SAT"  # Interface prefix
+# Interface prefix
+const_INT_PREFIX = config.getConfig(
+    config.parseMainConf(),
+    "",
+    "bridge_dbus_int_prefix",
+    "org.salutatoi.SAT")
 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
 const_OBJ_PATH = '/org/salutatoi/SAT/bridge'
 const_CORE_SUFFIX = ".core"
--- a/sat/bridge/dbus_bridge.py	Wed Jan 29 18:31:47 2020 +0100
+++ b/sat/bridge/dbus_bridge.py	Wed Jan 29 18:54:40 2020 +0100
@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
 
-
-# SAT: a jabber client
+# SàT communication bridge
 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
 
 # This program is free software: you can redistribute it and/or modify
@@ -23,12 +22,19 @@
 import dbus.mainloop.glib
 import inspect
 from sat.core.log import getLogger
-
-log = getLogger(__name__)
+from sat.tools import config
 from twisted.internet.defer import Deferred
 from sat.core.exceptions import BridgeInitError
 
-const_INT_PREFIX = "org.salutatoi.SAT"  # Interface prefix
+
+log = getLogger(__name__)
+
+# Interface prefix
+const_INT_PREFIX = config.getConfig(
+    config.parseMainConf(),
+    "",
+    "bridge_dbus_int_prefix",
+    "org.salutatoi.SAT")
 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
 const_OBJ_PATH = "/org/salutatoi/SAT/bridge"
 const_CORE_SUFFIX = ".core"
--- a/sat_frontends/bridge/dbus_bridge.py	Wed Jan 29 18:31:47 2020 +0100
+++ b/sat_frontends/bridge/dbus_bridge.py	Wed Jan 29 18:54:40 2020 +0100
@@ -1,7 +1,6 @@
 #!/usr/bin/env python3
-#-*- coding: utf-8 -*-
 
-# SAT communication bridge
+# SàT communication bridge
 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
 
 # This program is free software: you can redistribute it and/or modify
@@ -21,16 +20,23 @@
 import dbus
 import ast
 from sat.core.i18n import _
-from .bridge_frontend import BridgeException
+from sat.tools import config
 from sat.core.log import getLogger
 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError
 from dbus.mainloop.glib import DBusGMainLoop
+from .bridge_frontend import BridgeException
+
 
 DBusGMainLoop(set_as_default=True)
 log = getLogger(__name__)
 
 
-const_INT_PREFIX = "org.salutatoi.SAT"  # Interface prefix
+# Interface prefix
+const_INT_PREFIX = config.getConfig(
+    config.parseMainConf(),
+    "",
+    "bridge_dbus_int_prefix",
+    "org.salutatoi.SAT")
 const_ERROR_PREFIX = const_INT_PREFIX + ".error"
 const_OBJ_PATH = '/org/salutatoi/SAT/bridge'
 const_CORE_SUFFIX = ".core"