From 8495492c755792ddde1e9c41d363de794be153e6 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 26 Aug 2016 22:34:32 +0200 Subject: Fix #3193 (report PM errors in PM tab) --- poezio/core/handlers.py | 9 +++++++-- poezio/tabs/privatetab.py | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index 1ffb06a1..e8f1dd68 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -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) diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index 7a132167..54bcff96 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -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() -- cgit v1.2.3