Mercurial > libervia-backend
comparison libervia/backend/plugins/plugin_comp_ap_gateway/__init__.py @ 4297:0f953ce5f0a8
core (xmpp): move `is_local` to `SatXMPPEntity` + type hints + some log level changes.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Sep 2024 17:42:07 +0200 |
parents | 0d7bb4df2343 |
children |
comparison
equal
deleted
inserted
replaced
4296:ffc43219e0b2 | 4297:0f953ce5f0a8 |
---|---|
762 ) | 762 ) |
763 return "".join(account_elts) | 763 return "".join(account_elts) |
764 | 764 |
765 def is_local(self, jid_: jid.JID) -> bool: | 765 def is_local(self, jid_: jid.JID) -> bool: |
766 """Returns True if jid_ use a domain or subdomain of gateway's host""" | 766 """Returns True if jid_ use a domain or subdomain of gateway's host""" |
767 local_host = self.client.host.split(".") | 767 # FIXME: kept for compatiblity, need to be removed in favor of |
768 assert local_host | 768 # "self.client.is_local". |
769 return jid_.host.split(".")[-len(local_host) :] == local_host | 769 |
770 return self.client.is_local(jid_) | |
770 | 771 |
771 async def is_pubsub(self, jid_: jid.JID) -> bool: | 772 async def is_pubsub(self, jid_: jid.JID) -> bool: |
772 """Indicate if a JID is a Pubsub service""" | 773 """Indicate if a JID is a Pubsub service""" |
773 host_disco = await self.host.get_disco_infos(self.client, jid_) | 774 host_disco = await self.host.get_disco_infos(self.client, jid_) |
774 return ("pubsub", "service") in host_disco.identities and not ( | 775 return ("pubsub", "service") in host_disco.identities and not ( |