Unverified Commit cd9bae5c authored by mathieui's avatar mathieui

Fix MUC self-PM hidden stacktrace (#3454)

and do not display messages twice
parent 4e231185
......@@ -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:
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment