From 4d3e529e63799fd65a7f550796cd8ca34da7c0ac Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 3 Sep 2021 23:24:29 +0200 Subject: [PATCH] Updated according to RNS API. --- LXMF/LXMF.py | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/LXMF/LXMF.py b/LXMF/LXMF.py index 6a9ac11..72b4dd6 100644 --- a/LXMF/LXMF.py +++ b/LXMF/LXMF.py @@ -273,36 +273,32 @@ class LXMessage: pass def determine_transport_encryption(self): - if RNS.Reticulum.should_allow_unencrypted(): - self.transport_encrypted = False - self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_UNENCRYPTED - else: - if self.method == LXMessage.OPPORTUNISTIC: - if self.destination.type == RNS.Destination.SINGLE: - self.transport_encrypted = True - self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_EC - elif destination_type == RNS.Destination.GROUP: - self.transport_encrypted = True - self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_AES - else: - self.transport_encrypted = False - self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_UNENCRYPTED - elif self.method == LXMessage.DIRECT: + if self.method == LXMessage.OPPORTUNISTIC: + if self.destination.type == RNS.Destination.SINGLE: self.transport_encrypted = True self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_EC - elif self.method == LXMessage.PROPAGATED: - if self.destination.type == RNS.Destination.SINGLE: - self.transport_encrypted = True - self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_EC - elif destination_type == RNS.Destination.GROUP: - self.transport_encrypted = True - self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_AES - else: - self.transport_encrypted = False - self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_UNENCRYPTED + elif destination_type == RNS.Destination.GROUP: + self.transport_encrypted = True + self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_AES else: self.transport_encrypted = False self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_UNENCRYPTED + elif self.method == LXMessage.DIRECT: + self.transport_encrypted = True + self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_EC + elif self.method == LXMessage.PROPAGATED: + if self.destination.type == RNS.Destination.SINGLE: + self.transport_encrypted = True + self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_EC + elif destination_type == RNS.Destination.GROUP: + self.transport_encrypted = True + self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_AES + else: + self.transport_encrypted = False + self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_UNENCRYPTED + else: + self.transport_encrypted = False + self.transport_encryption = LXMessage.ENCRYPTION_DESCRIPTION_UNENCRYPTED def __mark_delivered(self, receipt = None): RNS.log("Received delivery notification for "+str(self), RNS.LOG_DEBUG)