# HG changeset patch # User Goffi # Date 1727698478 -7200 # Node ID 9658c534287e3c11bf9faf1acd3b14986e91a20c # Parent ef29fa1d9d69bd2d93936948ce45dfa73bc61f2f plugin XEP-0215, XEP-0376: fix bad calls to `hasFeature`: `hasFeature` was called like blocking code, missing the `await`. This has been fixed, and is now using the `memory.disco.has_feature` version. diff -r ef29fa1d9d69 -r 9658c534287e libervia/backend/plugins/plugin_xep_0215.py --- a/libervia/backend/plugins/plugin_xep_0215.py Sat Sep 28 16:00:16 2024 +0200 +++ b/libervia/backend/plugins/plugin_xep_0215.py Mon Sep 30 14:14:38 2024 +0200 @@ -179,7 +179,7 @@ try: cached_services = client._xep_0215_services[entity] except KeyError: - if not self.host.hasFeature(client, NS_EXTDISCO, entity): + if not await self.host.memory.disco.has_feature(client, NS_EXTDISCO, entity): cached_services = client._xep_0215_services[entity] = None else: iq_elt = client.IQ("get") diff -r ef29fa1d9d69 -r 9658c534287e libervia/backend/plugins/plugin_xep_0376.py --- a/libervia/backend/plugins/plugin_xep_0376.py Sat Sep 28 16:00:16 2024 +0200 +++ b/libervia/backend/plugins/plugin_xep_0376.py Mon Sep 30 14:14:38 2024 +0200 @@ -59,7 +59,7 @@ return XEP_0376_Handler() async def profile_connected(self, client): - if not self.host.hasFeature(client, NS_PAM): + if not await self.host.memory.disco.has_feature(client, NS_PAM): log.warning( "Your server doesn't support Pubsub Account Management, this is used to " "track all your subscriptions. You may ask your server administrator to " @@ -105,7 +105,7 @@ sub_jid: Optional[jid.JID] = None, options: Optional[dict] = None, ) -> Tuple[bool, Optional[pubsub.Subscription]]: - if not self.host.hasFeature(client, NS_PAM) or client.is_component: + if not await self.host.memory.disco.has_feature(client, NS_PAM) or client.is_component: return True, None await self._sub_request(client, service, nodeIdentifier, sub_jid, options, True) @@ -127,7 +127,7 @@ subscriptionIdentifier: Optional[str], sender: Optional[jid.JID] = None, ) -> bool: - if not self.host.hasFeature(client, NS_PAM) or client.is_component: + if not await self.host.memory.disco.has_feature(client, NS_PAM) or client.is_component: return True await self._sub_request(client, service, nodeIdentifier, sub_jid, None, False) return False @@ -138,7 +138,7 @@ service: Optional[jid.JID], node: str, ) -> Tuple[bool, Optional[List[Dict[str, Any]]]]: - if not self.host.hasFeature(client, NS_PAM): + if not await self.host.has_feature(client, NS_PAM): return True, None if service is not None or node is not None: # if we have service and/or node subscriptions, it's a regular XEP-0060