diff options
Diffstat (limited to 'sleekxmpp/plugins/xep_0184/receipt.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0184/receipt.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sleekxmpp/plugins/xep_0184/receipt.py b/sleekxmpp/plugins/xep_0184/receipt.py index 044fa83f..3e97d8db 100644 --- a/sleekxmpp/plugins/xep_0184/receipt.py +++ b/sleekxmpp/plugins/xep_0184/receipt.py @@ -26,13 +26,14 @@ class XEP_0184(BasePlugin): description = 'XEP-0184: Message Delivery Receipts' dependencies = set(['xep_0030']) stanza = stanza + default_config = { + 'auto_ack': True, + 'auto_request': False + } ack_types = ('normal', 'chat', 'headline') def plugin_init(self): - self.auto_ack = self.config.get('auto_ack', True) - self.auto_request = self.config.get('auto_request', False) - register_stanza_plugin(Message, Request) register_stanza_plugin(Message, Received) @@ -68,7 +69,7 @@ class XEP_0184(BasePlugin): ack['to'] = msg['from'] ack['from'] = msg['to'] ack['receipt'] = msg['id'] - ack['id'] = self.xmpp.new_id() + ack['id'] = msg['id'] ack.send() def _handle_receipt_received(self, msg): @@ -117,6 +118,9 @@ class XEP_0184(BasePlugin): if stanza['receipt']: return stanza + if not stanza['body']: + return stanza + if stanza['to'].resource: if not self.xmpp['xep_0030'].supports(stanza['to'], feature='urn:xmpp:receipts', |