Mercurial > libervia-backend
changeset 3834:3260401fdb98
cli: helper method to retrieve profile's jid:
rel 369
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 10 Jul 2022 16:15:09 +0200 |
parents | 381340b9a9ee |
children | f599e0e36444 |
files | sat_frontends/jp/base.py |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_frontends/jp/base.py Sun Jul 10 16:15:06 2022 +0200 +++ b/sat_frontends/jp/base.py Sun Jul 10 16:15:09 2022 +0200 @@ -697,7 +697,10 @@ await self.bridge.bridgeConnect() except Exception as e: if isinstance(e, exceptions.BridgeExceptionNoService): - print(_("Can't connect to SàT backend, are you sure it's launched ?")) + print( + _("Can't connect to Libervia backend, are you sure that it's " + "launched ?") + ) self.quit(C.EXIT_BACKEND_NOT_FOUND, raise_exc=False) elif isinstance(e, exceptions.BridgeInitError): print(_("Can't init bridge")) @@ -968,6 +971,13 @@ return f"{_jid.bare}/{main_resource}" return param_jid + async def get_profile_jid(self): + """Retrieve current profile bare JID if possible""" + full_jid = await self.bridge.asyncGetParamA( + "JabberID", "Connection", profile_key=self.profile + ) + return full_jid.rsplit("/", 1)[0] + class CommandBase(object):