# HG changeset patch # User Goffi # Date 1657462509 -7200 # Node ID 3260401fdb987318e96b0a05883cd7912c2cb00d # Parent 381340b9a9eebcd32f2b38b9ef177cb5e47643d8 cli: helper method to retrieve profile's jid: rel 369 diff -r 381340b9a9ee -r 3260401fdb98 sat_frontends/jp/base.py --- 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):