From 7b3265c636baef56e0468891cff236a462dad0a2 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 8 Dec 2014 23:50:16 +0100 Subject: Fix #2754 (make /xhtml send a message with receipts, chatstates and display it properly) (also make the message appear in PrivateTabs) --- src/tabs/basetabs.py | 14 ++++++++++++++ src/tabs/conversationtab.py | 8 -------- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 81a14253..c238bbd4 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -746,6 +746,20 @@ class OneToOneTab(ChatTab): self.text_win.modify_message(msg_id, new_msg) self.core.refresh_window() + @command_args_parser.raw + def command_xhtml(self, xhtml_data): + message = self.generate_xhtml_message(xhtml_data) + if message: + if self.remote_supports_receipts: + message._add_receipt = True + if self.remote_wants_chatstates: + message['chat_sate'] = 'active' + message.send() + body = xhtml.xhtml_to_poezio_colors(xhtml_data, force=True) + self._text_buffer.add_message(body, nickname=self.core.own_nick, + identifier=message['id'],) + self.refresh() + def check_features(self): "check the features supported by the other party" if safeJID(self.get_dest_jid()).resource: diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py index 2ab33bb9..f4c10301 100644 --- a/src/tabs/conversationtab.py +++ b/src/tabs/conversationtab.py @@ -151,14 +151,6 @@ class ConversationTab(OneToOneTab): self.text_win.refresh() self.input.refresh() - @command_args_parser.raw - def command_xhtml(self, xhtml): - message = self.generate_xhtml_message(xhtml) - if message: - message.send() - self.core.add_message_to_text_buffer(self._text_buffer, message['body'], None, self.core.own_nick) - self.refresh() - @command_args_parser.quoted(0, 1) def command_last_activity(self, args): """ -- cgit v1.2.3