Fix #3193 (report PM errors in PM tab)

This commit is contained in:
mathieui 2016-08-26 22:34:32 +02:00
parent b00d2fd2bc
commit 8495492c75
2 changed files with 13 additions and 2 deletions

View file

@ -220,10 +220,15 @@ class HandlerCore:
jid_from = message['from']
for tab in self.core.get_tabs(tabs.MucTab):
if tab.name == jid_from.bare:
if message['type'] == 'error':
if jid_from.full == jid_from.bare:
self.core.room_error(message, jid_from.bare)
else:
self.on_groupchat_private_message(message)
text = self.core.get_error_message(message)
p_tab = self.core.get_tab_by_name(jid_from.full, tabs.PrivateTab)
if p_tab:
p_tab.add_error(text)
else:
self.core.information(text, 'Error')
return
tab = self.core.get_conversation_by_jid(message['from'], create=False)
error_msg = self.core.get_error_message(message, deprecated=True)

View file

@ -360,4 +360,10 @@ class PrivateTab(OneToOneTab):
def matching_names(self):
return [(3, safeJID(self.name).resource), (4, self.name)]
def add_error(self, error_message):
error = '\x19%s}%s\x19o' % (dump_tuple(get_theme().COLOR_CHAR_NACK),
error_message)
self.add_message(error, highlight=True, nickname='Error',
nick_color=get_theme().COLOR_ERROR_MSG, typ=2)
self.core.refresh_window()