Skip to content

Commit

Permalink
fix(qchat): play sound only on mention (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
gounux authored Oct 8, 2024
1 parent 2052276 commit 72c562e
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions qtribu/gui/dck_qchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ def on_ws_message_received(self, message: str) -> None:
.get_plg_settings()
.notify_push_duration,
)

# check if a notification sound should be played
if self.settings.qchat_play_sounds:
play_resource_sound(
self.settings.qchat_ring_tone, self.settings.qchat_sound_volume
)
elif message["author"] == self.settings.author_nickname:
item = self.create_message_item(
message["author"],
Expand All @@ -397,15 +403,6 @@ def on_ws_message_received(self, message: str) -> None:
self.twg_chat.addTopLevelItem(item)
self.twg_chat.scrollToItem(item)

# check if a notification sound should be played
if (
self.settings.qchat_play_sounds
and message["author"] != self.settings.author_nickname
):
play_resource_sound(
self.settings.qchat_ring_tone, self.settings.qchat_sound_volume
)

def handle_internal_message(self, message: dict[str, Any]) -> None:
"""
Handle an internal message, spotted by its author
Expand Down

0 comments on commit 72c562e

Please sign in to comment.