diff options
author | Philipp Hörist <philipp@hoerist.com> | 2019-10-12 16:17:20 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2019-10-12 16:17:20 +0300 |
commit | a15b98aec870e0e6c8fac08f102b5da182aa0470 (patch) | |
tree | e87004f322cdf374c9bcb7c4d553e24471536b01 /nbxmpp/structs.py | |
parent | 64b8f9b754610ac1f6e8c8f55f0a117bfaa4ffcf (diff) |
Add Receipts (XEP-0184) support
Diffstat (limited to 'nbxmpp/structs.py')
-rw-r--r-- | nbxmpp/structs.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nbxmpp/structs.py b/nbxmpp/structs.py index bc3b103..a6fe984 100644 --- a/nbxmpp/structs.py +++ b/nbxmpp/structs.py @@ -485,6 +485,22 @@ class CarbonData(namedtuple('MAMData', 'type')): return self.type == 'received' +class ReceiptData(namedtuple('ReceiptData', 'type id')): + + __slots__ = [] + + def __new__(cls, type, id=None): + return super(ReceiptData, cls).__new__(cls, type, id) + + @property + def is_request(self): + return self.type == 'request' + + @property + def is_received(self): + return self.type == 'received' + + class Properties: pass @@ -528,6 +544,7 @@ class MessageProperties: self.encrypted = None self.pgp_legacy = None self.marker = None + self.receipt = None @property def has_user_delay(self): @@ -604,6 +621,10 @@ class MessageProperties: def is_marker(self): return self.marker is not None + @property + def is_receipt(self): + return self.receipt is not None + class IqProperties: def __init__(self): |