aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-08-18 09:33:58 -0400
committerfrosty <gabriel@bwaaa.monster>2026-08-18 09:33:58 -0400
commit7cf1a12faa2c7781f6277c75702f62f1404752a2 (patch)
treeeaeca30bc866ab315cbbbdc95f8b0ca9048436f2 /libdino/src/service
parentb35e793a5dd52cc345747f531653270765454934 (diff)
Make it so notifications are not sent for messages older than 15 seconds
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/notification_events.vala3
1 files changed, 3 insertions, 0 deletions
diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala
index 3e077dfc..1830bab4 100644
--- a/libdino/src/service/notification_events.vala
+++ b/libdino/src/service/notification_events.vala
@@ -7,6 +7,7 @@ namespace Dino {
public class NotificationEvents : StreamInteractionModule, Object {
public static ModuleIdentity<NotificationEvents> IDENTITY = new ModuleIdentity<NotificationEvents>("notification_events");
+ private const int MESSAGE_NOTIFICATION_MAX_AGE_SECONDS = 15;
public string id { get { return IDENTITY.id; } }
public signal void notify_content_item(ContentItem content_item, Conversation conversation);
@@ -66,6 +67,8 @@ public class NotificationEvents : StreamInteractionModule, Object {
Message message = ((MessageItem) item).message;
if (message.direction == Message.DIRECTION_SENT) return;
+ DateTime? message_time = message.time;
+ if (message_time != null && message_time.compare(new DateTime.now_utc().add_seconds(-MESSAGE_NOTIFICATION_MAX_AGE_SECONDS)) < 0) return;
if (notify == Conversation.NotifySetting.HIGHLIGHT) {
Jid? nick = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);