diff --git a/src/backend/backend.py b/src/backend/backend.py index a89edd0e..a114a7b3 100644 --- a/src/backend/backend.py +++ b/src/backend/backend.py @@ -317,7 +317,8 @@ class Backend: """ async def update(client: MatrixClient) -> None: - room = self.models[client.user_id, "rooms"].get(room_id) + room = self.models[client.user_id, "rooms"].get(room_id) + account = self.models["accounts"][client.user_id] if room: room.set_fields( @@ -327,7 +328,10 @@ class Backend: local_highlights = False, ) await client.update_account_unread_counts() - await client.update_receipt_marker(room_id, event_id) + + # Only update server markers if the account is not invisible + if account.presence != Presence.State.invisible: + await client.update_receipt_marker(room_id, event_id) await asyncio.gather(*[update(c) for c in self.clients.values()]) diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 2076168b..55a21e86 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -1064,6 +1064,17 @@ class MatrixClient(nio.AsyncClient): ]) + async def room_typing( + self, room_id: str, typing_state: bool = True, timeout: int = 5000, + ): + """Set typing notice to the server.""" + + # Do not send typing notice if the user is invisible + if self.models["accounts"][self.user_id].presence != \ + Presence.State.invisible: + await super().room_typing(room_id, typing_state, timeout) + + async def get_redacted_event_content( self, nio_type: Type[nio.Event], @@ -1222,11 +1233,11 @@ class MatrixClient(nio.AsyncClient): async def set_presence( - self, presence: str, status_msg: str = None, + self, presence: str, status_msg: Optional[str] = None, ) -> None: """Set presence state for this account.""" - status_msg = status_msg or ( + status_msg = status_msg if status_msg is not None else ( self.models["accounts"][self.user_id].status_msg ) diff --git a/src/gui/MainPane/AccountDelegate.qml b/src/gui/MainPane/AccountDelegate.qml index fdd0540b..9de10254 100644 --- a/src/gui/MainPane/AccountDelegate.qml +++ b/src/gui/MainPane/AccountDelegate.qml @@ -66,8 +66,9 @@ HTile { } HColumnLayout { + id: title + TitleLabel { - id: title text: model.display_name || model.id color: hovered ? @@ -82,12 +83,22 @@ HTile { } SubtitleLabel { + id: statusMsg tile: account - text: model.status_msg - visible: model.status_msg + text: utils.escapeHtml(model.status_msg.trim()) + visible: model.status_msg.trim() Layout.leftMargin: theme.spacing } + + HoverHandler { id: nameHover } + + HToolTip { + visible: nameHover.hovered + text: + model.id + + (statusMsg.text ? " - " + model.status_msg.trim() : "") + } } HButton { diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml index 864c9937..51a38f1c 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDelegate.qml @@ -2,6 +2,7 @@ import QtQuick 2.12 import Clipboard 0.1 +import "../../../.." import "../../../../Base" import "../../../../Base/HTile" import "../../../../Popups" @@ -57,7 +58,20 @@ HTile { SubtitleLabel { tile: member color: theme.chat.roomPane.listView.member.subtitle - text: model.status_msg.trim() || model.id + text: utils.escapeHtml(model.status_msg.trim()) || model.id + } + + HoverHandler { id: nameHover } + + HToolTip { + visible: nameHover.hovered + text: + model.id + + ( + model.status_msg.trim() ? + " - " + model.status_msg.trim() : + "" + ) } } }