diff options
author | mathieui <mathieui@mathieui.net> | 2019-02-24 14:19:33 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2019-02-24 14:19:33 +0100 |
commit | cd9bae5c2972136472ef1a9ebdd8e900be1c8048 (patch) | |
tree | 1869d23bb4b7f93bd1c290c2d1d057852ff5e21e | |
parent | 4e231185f5569a3caf8acd347cd5d7e652ab0ce4 (diff) | |
download | poezio-cd9bae5c2972136472ef1a9ebdd8e900be1c8048.tar.gz poezio-cd9bae5c2972136472ef1a9ebdd8e900be1c8048.tar.bz2 poezio-cd9bae5c2972136472ef1a9ebdd8e900be1c8048.tar.xz poezio-cd9bae5c2972136472ef1a9ebdd8e900be1c8048.zip |
Fix MUC self-PM hidden stacktrace (#3454)
and do not display messages twice
-rw-r--r-- | poezio/tabs/basetabs.py | 6 | ||||
-rw-r--r-- | poezio/tabs/privatetab.py | 14 |
2 files changed, 15 insertions, 5 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index 578668fc..f5a4ccf0 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -818,7 +818,7 @@ class OneToOneTab(ChatTab): msg += 'show: %s, ' % SHOW_NAME[status.show] self.add_message(msg[:-2], typ=2) - def ack_message(self, msg_id, msg_jid): + def ack_message(self, msg_id: str, msg_jid: JID): """ Ack a message """ @@ -827,9 +827,9 @@ class OneToOneTab(ChatTab): self.text_win.modify_message(msg_id, new_msg) self.core.refresh_window() - def nack_message(self, error, msg_id, msg_jid): + def nack_message(self, error: str, msg_id: str, msg_jid: JID): """ - Ack a message + Non-ack a message (e.g. timeout) """ new_msg = self._text_buffer.nack_message(error, msg_id, msg_jid) if new_msg: diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index 4811f14e..35e5feaa 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -14,6 +14,8 @@ import curses import logging from typing import Dict, Callable +from slixmpp import JID + from poezio.tabs import OneToOneTab, MucTab, Tab from poezio import windows @@ -85,6 +87,12 @@ class PrivateTab(OneToOneTab): def nick(self): return self.get_nick() + def ack_message(self, msg_id: str, msg_jid: JID): + # special case when talking to oneself + if msg_jid == self.core.xmpp.boundjid: + msg_jid = JID(self.name) + super().ack_message(msg_id, msg_jid) + @staticmethod def add_information_element(plugin_name, callback): """ @@ -141,6 +149,7 @@ class PrivateTab(OneToOneTab): def command_say(self, line, attention=False, correct=False): if not self.on: return + echo_message = JID(self.name).resource != self.own_nick msg = self.core.xmpp.make_message(self.name) msg['type'] = 'chat' msg['body'] = line @@ -157,7 +166,8 @@ class PrivateTab(OneToOneTab): replaced = False if correct or msg['replace']['id']: msg['replace']['id'] = self.last_sent_message['id'] - if config.get_by_tabname('group_corrections', self.name): + if (config.get_by_tabname('group_corrections', self.name) + and echo_message): try: self.modify_message( msg['body'], @@ -187,7 +197,7 @@ class PrivateTab(OneToOneTab): self.text_win.refresh() self.input.refresh() return - if not replaced: + if not replaced and echo_message: self.add_message( msg['body'], nickname=self.own_nick or self.core.own_nick, |