From 5999b71c416f02dc11803bf52a406b9109ddc3c1 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 27 Apr 2014 16:32:03 +0200 Subject: Fix #2106 (implement message delivery receipts) - two options request/ack_message_receipts - two new theme parameters : CHAR_ACK_RECEIVED and COLOR_CHAR_ACK - if a message has a receipt, the character is displayed between the timestamp and the nick, using the color --- src/core/handlers.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/core/handlers.py') diff --git a/src/core/handlers.py b/src/core/handlers.py index 7ce14c65..58217e8f 100644 --- a/src/core/handlers.py +++ b/src/core/handlers.py @@ -59,6 +59,8 @@ def on_carbon_received(self, message): else: return recv['to'] = self.xmpp.boundjid.full + if recv['receipt']: + return self.on_receipt(recv) self.on_normal_message(recv) def on_carbon_sent(self, message): @@ -955,6 +957,22 @@ def on_groupchat_subject(self, message): if self.get_tab_by_name(room_from, tabs.MucTab) is self.current_tab(): self.refresh_window() +def on_receipt(self, message): + """ + When a delivery receipt is received (XEP-0184) + """ + jid = message['from'] + msg_id = message['receipt'] + if not msg_id: + return + + conversation = self.get_tab_by_name(jid) + conversation = conversation or self.get_tab_by_name(jid.bare) + if not conversation: + return + + conversation.ack_message(msg_id) + def on_data_form(self, message): """ When a data form is received -- cgit v1.2.3