Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F112130
D21.1732272013.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21.1732272013.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 2:40 AM (11 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38794
Default Alt Text
D21.1732272013.diff (1 KB)
Attached To
Mode
D21: Differentiate between messages with and without sound
Attached
Detach File
Event Timeline
Log In to Comment