]> www.infradead.org Git - pidgin-chime.git/commitdiff
Less beeping for ancient messages.
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 31 Mar 2020 22:44:40 +0000 (23:44 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 31 Mar 2020 22:52:11 +0000 (23:52 +0100)
prpl/chat.c
prpl/conversations.c

index 3601dd817f46767eee1775d2f7afd02a3bbdceb7..da9fb9d700d880307827accd811564cb12dbec94 100644 (file)
@@ -174,6 +174,10 @@ static void do_chat_deliver_msg(ChimeConnection *cxn, struct chime_msgs *msgs,
                download_attachment(cxn, att, ctx);
        }
 
+       /* If the message is over a day old, don't beep for it. */
+       if (msg_time + 86400 < time(NULL))
+               msg_flags |= PURPLE_MESSAGE_DELAYED;
+
        if (parse_string(node, "Content", &content)) {
                gchar *escaped = g_markup_escape_text(content, -1);
 
index 1c9a731ae5b35b3c74e60fc259810781bd7ac6a8..1bebb9d109decb37673ccafaf51872964f222317 100644 (file)
@@ -47,6 +47,9 @@ static gboolean do_conv_deliver_msg(ChimeConnection *cxn, struct chime_im *im,
        PurpleMessageFlags flags = 0;
        if (sys)
                flags |= PURPLE_MESSAGE_SYSTEM;
+       /* If the message is over a day old, don't beep for it. */
+       if (msg_time + 86400 < time(NULL))
+               flags |= PURPLE_MESSAGE_DELAYED;
 
        const gchar *email = chime_contact_get_email(im->peer);
        const gchar *from = _("Unknown sender");