Software /
code /
prosody-modules
Changeset
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 |
parents | 2434:a43242289fce |
children | 2436:a01a3fb96302 |
files | mod_delay/mod_delay.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
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