From f0e9fa66598b31e3ae4bcc9f188bb63bc298ba5e Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 16 Jan 2024 13:26:33 +0100 Subject: [PATCH] Corrected inconsistent property, getter and setter use. Fixed #16. --- LXMF/LXMessage.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/LXMF/LXMessage.py b/LXMF/LXMessage.py index 0fe1ccf..3cf8122 100644 --- a/LXMF/LXMessage.py +++ b/LXMF/LXMessage.py @@ -170,6 +170,17 @@ class LXMessage: def get_fields(self): return self.fields + @property + def destination(self): + return self.__destination + + @destination.setter + def destination(self, destination): + self.set_destination(destination) + + def get_destination(self): + return self.destination + def set_destination(self, destination): if self.destination == None: if isinstance(destination, RNS.Destination): @@ -179,8 +190,16 @@ class LXMessage: else: raise ValueError("Cannot reassign destination on LXMessage") - def get_destination(self): - return self.__destination + @property + def source(self): + return self.__source + + @source.setter + def source(self, source): + self.set_source(source) + + def get_source(self): + return self.source def set_source(self, source): if self.source == None: @@ -191,9 +210,6 @@ class LXMessage: else: raise ValueError("Cannot reassign source on LXMessage") - def get_source(self): - return self.__source - def set_delivery_destination(self, delivery_destination): self.__delivery_destination = delivery_destination