Software /
code /
prosody-modules
Diff
mod_delay/mod_delay.lua @ 2435:05248d5a7166
mod_delay: Only add delay to messages of type chat or groupchat (fixes #811)
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Sun, 08 Jan 2017 06:26:21 +0100 |
parent | 2393:3b2c94ea0c2e |
child | 3054:5e94061c1aa7 |
line wrap: on
line diff
--- 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