# HG changeset patch # User tmolitor # Date 1483853181 -3600 # Node ID 05248d5a716622a7eb85e9f76df8aad1a6610e67 # Parent a43242289fcecda554e05b3272d88aef05abbf44 mod_delay: Only add delay to messages of type chat or groupchat (fixes #811) diff -r a43242289fce -r 05248d5a7166 mod_delay/mod_delay.lua --- a/mod_delay/mod_delay.lua Thu Jan 05 03:44:44 2017 +0100 +++ b/mod_delay/mod_delay.lua Sun Jan 08 06:26:21 2017 +0100 @@ -11,8 +11,11 @@ local add_delay = function(stanza, session) if stanza and stanza.name == "message" and stanza:get_child("delay", xmlns_delay) == nil then - -- session.log("debug", "adding delay to message %s", tostring(stanza)); - stanza = stanza:tag("delay", { xmlns = xmlns_delay, from = session.host, stamp = datetime.datetime()}); + -- only add delay tag to chat or groupchat messages (should we add a delay to anything else, too???) + if stanza.attr.type == "chat" or stanza.attr.type == "groupchat" then + -- session.log("debug", "adding delay to message %s", tostring(stanza)); + stanza = stanza:tag("delay", { xmlns = xmlns_delay, from = session.host, stamp = datetime.datetime()}); + end end return stanza; end