summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2016-08-26 22:34:32 +0200
committermathieui <mathieui@mathieui.net>2016-08-26 22:34:32 +0200
commit8495492c755792ddde1e9c41d363de794be153e6 (patch)
treea27e902dbc1b55dc0a847cd2b5374c487c524e35
parentb00d2fd2bc6172ce2b442147f2a0fab5640cc9ca (diff)
downloadpoezio-8495492c755792ddde1e9c41d363de794be153e6.tar.gz
poezio-8495492c755792ddde1e9c41d363de794be153e6.tar.bz2
poezio-8495492c755792ddde1e9c41d363de794be153e6.tar.xz
poezio-8495492c755792ddde1e9c41d363de794be153e6.zip
Fix #3193 (report PM errors in PM tab)
-rw-r--r--poezio/core/handlers.py9
-rw-r--r--poezio/tabs/privatetab.py6
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()