Added opportunistic delivery if destination ratchets are available

This commit is contained in:
Mark Qvist 2024-10-06 11:25:08 +02:00
parent c61da069f2
commit 0e79c3299c

View File

@ -216,6 +216,10 @@ class Conversation:
if self.app.directory.preferred_delivery(dest.hash) == DirectoryEntry.PROPAGATED: if self.app.directory.preferred_delivery(dest.hash) == DirectoryEntry.PROPAGATED:
if self.app.message_router.get_outbound_propagation_node() != None: if self.app.message_router.get_outbound_propagation_node() != None:
desired_method = LXMF.LXMessage.PROPAGATED desired_method = LXMF.LXMessage.PROPAGATED
else:
if not self.app.message_router.delivery_link_available(dest.hash) and RNS.Identity.current_ratchet_id(dest.hash) != None:
RNS.log(f"Have ratchet for {RNS.prettyhexrep(dest.hash)}, requesting opportunistic delivery of message", RNS.LOG_DEBUG)
desired_method = LXMF.LXMessage.OPPORTUNISTIC
dest_is_trusted = False dest_is_trusted = False
if self.app.directory.trust_level(dest.hash) == DirectoryEntry.TRUSTED: if self.app.directory.trust_level(dest.hash) == DirectoryEntry.TRUSTED: