From: David Woodhouse Date: Tue, 31 Mar 2020 22:44:40 +0000 (+0100) Subject: Less beeping for ancient messages. X-Git-Tag: v1.4~20 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=26ddd8ef40544025a4872beb27cc32099547c10f;p=pidgin-chime.git Less beeping for ancient messages. --- diff --git a/prpl/chat.c b/prpl/chat.c index 3601dd8..da9fb9d 100644 --- a/prpl/chat.c +++ b/prpl/chat.c @@ -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); diff --git a/prpl/conversations.c b/prpl/conversations.c index 1c9a731..1bebb9d 100644 --- a/prpl/conversations.c +++ b/prpl/conversations.c @@ -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");