From e84436adfdf37de9318c9252e2bab9c81744e0b0 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 10 Jul 2022 16:15:09 +0200 Subject: [PATCH] cli: helper method to retrieve profile's jid: rel 369 --- sat_frontends/jp/base.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sat_frontends/jp/base.py b/sat_frontends/jp/base.py index 7213bb76..9f0ce9b2 100644 --- a/sat_frontends/jp/base.py +++ b/sat_frontends/jp/base.py @@ -697,7 +697,10 @@ class LiberviaCli: 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 @@ class LiberviaCli: 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):