core (xmpp): make client.encryption a property to make pyright happy

This commit is contained in:
Goffi 2026-07-05 17:44:39 +02:00
commit 7b2afd238b

View file

@ -150,7 +150,7 @@ class SatXMPPEntity(core_types.SatXMPPEntity):
self._progress_cb = {} # callback called when a progress is requested
# (key = progress id)
self.actions = {} # used to keep track of actions for retrieval (key = action_id)
self.encryption = encryption.EncryptionHandler(self)
self._encryption = encryption.EncryptionHandler(self)
def __str__(self):
return f"Client for profile {self.profile}"
@ -158,6 +158,10 @@ class SatXMPPEntity(core_types.SatXMPPEntity):
def __repr__(self):
return f"{super().__repr__()} - profile: {self.profile!r}"
@property
def encryption(self) -> "encryption.EncryptionHandler":
return self._encryption
@property
def tor_mode(self) -> TorMode:
"""Return Tor mode for this profile."""
@ -386,7 +390,7 @@ class SatXMPPEntity(core_types.SatXMPPEntity):
**kwargs,
)
await entity.encryption.load_sessions()
await entity._encryption.load_sessions()
entity._create_sub_protocols()
@ -951,7 +955,7 @@ class SatXMPPEntity(core_types.SatXMPPEntity):
if not no_trigger and not send_only:
# is the session encrypted? If so we indicate it in data
self.encryption.set_encryption_flag(data)
self._encryption.set_encryption_flag(data)
if not self.host_app.trigger.point(
"sendMessage" + self.trigger_suffix,
@ -1886,7 +1890,7 @@ class SatMessageProtocol(xmppim.MessageProtocol):
data["extra"]["delay_sender"] = data["delay_sender"]
except KeyError:
pass
if self.client.encryption.isEncrypted(data):
if self.client._encryption.isEncrypted(data):
data["extra"]["encrypted"] = True
if data is not None:
if self.parent.is_message_printable(data):