Page MenuHomePhorge

D21.1732544043.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D21.1732544043.diff

diff --git a/kazv.notifyrc b/kazv.notifyrc
--- a/kazv.notifyrc
+++ b/kazv.notifyrc
@@ -14,3 +14,10 @@
Contexts=messages
Action=Popup|Sound
Urgency=Normal
+
+[Event/messageWithoutSound]
+Name=Message without sound
+Comment=Received a message without sound
+Contexts=messages
+Action=Popup
+Urgency=Normal
diff --git a/src/contents/ui/Notifier.qml b/src/contents/ui/Notifier.qml
--- a/src/contents/ui/Notifier.qml
+++ b/src/contents/ui/Notifier.qml
@@ -28,6 +28,7 @@
if (matrixSdk.shouldNotify(event)) {
console.debug('Push rules say we should notify this');
const notification = notificationComp.createObject(notifier);
+ notification.eventId = matrixSdk.shouldPlaySound(event) ? 'message' : 'messageWithoutSound';
notification.title = Helpers.roomNameOrHeroes(room, l10n);
const message = event.content.body;
notification.text = message
diff --git a/src/matrix-sdk.hpp b/src/matrix-sdk.hpp
--- a/src/matrix-sdk.hpp
+++ b/src/matrix-sdk.hpp
@@ -197,6 +197,17 @@
*/
bool shouldNotify(MatrixEvent *event) const;
+ /**
+ * Check if an event should be notified with sound.
+ *
+ * You should only call this method when `shouldNotify(event)`
+ * returns true.
+ *
+ * @param event The event to check.
+ * @return Whether `event` should be notified with sound.
+ */
+ bool shouldPlaySound(MatrixEvent *event) const;
+
/**
* Get the sticker pack list for the current account.
*
diff --git a/src/matrix-sdk.cpp b/src/matrix-sdk.cpp
--- a/src/matrix-sdk.cpp
+++ b/src/matrix-sdk.cpp
@@ -614,6 +614,11 @@
return m_d->notificationHandler.handleNotification(event->underlyingEvent()).shouldNotify;
}
+bool MatrixSdk::shouldPlaySound(MatrixEvent *event) const
+{
+ return m_d->notificationHandler.handleNotification(event->underlyingEvent()).sound.has_value();
+}
+
MatrixStickerPackList *MatrixSdk::stickerPackList() const
{
return new MatrixStickerPackList(m_d->clientOnSecondaryRoot);

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 6:14 AM (11 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39825
Default Alt Text
D21.1732544043.diff (1 KB)

Event Timeline