From 8f9e14dcb67f494d80f3b28d30df17a187999722 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 29 Sep 2016 23:47:54 +0200 Subject: Display status changes in one to one chats Make hide_status_change work there as well, with per-jid configuration --- poezio/core/core.py | 4 ++-- poezio/core/handlers.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'poezio/core') diff --git a/poezio/core/core.py b/poezio/core/core.py index 2ec71cb2..3f435aa3 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -1334,10 +1334,10 @@ class Core(object): if tab.name.startswith(room_name): tab.activate(reason=reason) - def on_user_changed_status_in_private(self, jid, msg): + def on_user_changed_status_in_private(self, jid, status): tab = self.get_tab_by_name(jid, tabs.ChatTab) if tab is not None: # display the message in private - tab.add_message(msg, typ=2) + tab.update_status(status) def close_tab(self, tab=None): """ diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index 3b7d0b46..0427a2d0 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -28,6 +28,7 @@ from poezio import xhtml from poezio import multiuserchat as muc from poezio.common import safeJID from poezio.config import config, CACHE_DIR +from poezio.core.structs import Status from poezio.contact import Resource from poezio.logger import logger from poezio.roster import roster @@ -299,6 +300,9 @@ class HandlerCore: elif not own: remote_nick = conversation.get_nick() + if not own: + conversation.last_remote_message = datetime.now() + self.core.events.trigger('conversation_msg', message, conversation) if not message['body']: return @@ -607,6 +611,7 @@ class HandlerCore: if msg and body: self.core.xmpp.send_message(mto=jid.full, mbody=msg, mtype='chat') return + tab.last_remote_message = datetime.now() self.core.events.trigger('private_msg', message, tab) body = xhtml.get_body_from_message_stanza(message, use_xhtml=use_xhtml, tmp_dir=tmp_dir, @@ -830,6 +835,8 @@ class HandlerCore: contact.error = None self.core.events.trigger('normal_presence', presence, contact[jid.full]) tab = self.core.get_conversation_by_jid(jid, create=False) + if tab: + tab.update_status(Status(show=presence['show'], message=presence['status'])) if isinstance(self.core.current_tab(), tabs.RosterInfoTab): self.core.refresh_window() elif self.core.current_tab() == tab: -- cgit v1.2.3