Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
3748:53a8b50d69ca | 3749:9581098b64f0 |
---|---|
847 "certificate validation, please activate \"Check certificate\" in your " | 847 "certificate validation, please activate \"Check certificate\" in your " |
848 "settings in \"Connection\" tab.")) | 848 "settings in \"Connection\" tab.")) |
849 xml_tools.quickNote(host_app, self, msg, _("Security notice"), | 849 xml_tools.quickNote(host_app, self, msg, _("Security notice"), |
850 level = C.XMLUI_DATA_LVL_WARNING) | 850 level = C.XMLUI_DATA_LVL_WARNING) |
851 | 851 |
852 @property | |
853 def server_jid(self): | |
854 return jid.JID(self.jid.host) | |
852 | 855 |
853 def _getPluginsList(self): | 856 def _getPluginsList(self): |
854 for p in self.host_app.plugins.values(): | 857 for p in self.host_app.plugins.values(): |
855 if C.PLUG_MODE_CLIENT in p._info["modes"]: | 858 if C.PLUG_MODE_CLIENT in p._info["modes"]: |
856 yield p | 859 yield p |
998 raise ValueError("Can't guess host from jid, please specify a host") | 1001 raise ValueError("Can't guess host from jid, please specify a host") |
999 # XXX: component.Component expect unicode jid, while Client expect jid.JID. | 1002 # XXX: component.Component expect unicode jid, while Client expect jid.JID. |
1000 # this is not consistent, so we use jid.JID for SatXMPP* | 1003 # this is not consistent, so we use jid.JID for SatXMPP* |
1001 component.Component.__init__(self, host, port, component_jid.full(), password) | 1004 component.Component.__init__(self, host, port, component_jid.full(), password) |
1002 SatXMPPEntity.__init__(self, host_app, profile, max_retries) | 1005 SatXMPPEntity.__init__(self, host_app, profile, max_retries) |
1006 | |
1007 @property | |
1008 def server_jid(self): | |
1009 # FIXME: not the best way to get server jid, maybe use config option? | |
1010 return jid.JID(self.jid.host.split(".", 1)[-1]) | |
1003 | 1011 |
1004 def _buildDependencies(self, current, plugins, required=True): | 1012 def _buildDependencies(self, current, plugins, required=True): |
1005 """build recursively dependencies needed for a plugin | 1013 """build recursively dependencies needed for a plugin |
1006 | 1014 |
1007 this method build list of plugin needed for a component and raises | 1015 this method build list of plugin needed for a component and raises |