diff sat/core/xmpp.py @ 3749:9581098b64f0

core (xmpp): add a `server_jid` property
author Goffi <goffi@goffi.org>
date Fri, 13 May 2022 17:52:43 +0200
parents e52de21873d3
children 001ea5f4a2f9
line wrap: on
line diff
--- a/sat/core/xmpp.py	Tue Mar 22 17:00:42 2022 +0100
+++ b/sat/core/xmpp.py	Fri May 13 17:52:43 2022 +0200
@@ -849,6 +849,9 @@
             xml_tools.quickNote(host_app, self, msg, _("Security notice"),
                 level = C.XMLUI_DATA_LVL_WARNING)
 
+    @property
+    def server_jid(self):
+        return jid.JID(self.jid.host)
 
     def _getPluginsList(self):
         for p in self.host_app.plugins.values():
@@ -1001,6 +1004,11 @@
         component.Component.__init__(self, host, port, component_jid.full(), password)
         SatXMPPEntity.__init__(self, host_app, profile, max_retries)
 
+    @property
+    def server_jid(self):
+        # FIXME: not the best way to get server jid, maybe use config option?
+        return jid.JID(self.jid.host.split(".", 1)[-1])
+
     def _buildDependencies(self, current, plugins, required=True):
         """build recursively dependencies needed for a plugin