changeset 285:108ac6f16d2d

mod_muc_intercom: Add a delay to the forwarded message.
author Kim Alvefur <zash@zash.se>
date Wed, 08 Dec 2010 19:01:13 +0100
parents 3b96bba9f7e5
children ca6199d73d68
files mod_muc_intercom/mod_muc_intercom.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_intercom/mod_muc_intercom.lua	Thu Dec 02 17:22:34 2010 +0500
+++ b/mod_muc_intercom/mod_muc_intercom.lua	Wed Dec 08 19:01:13 2010 +0100
@@ -4,6 +4,7 @@
 local host_session = prosody.hosts[module.host];
 local st_msg = require "util.stanza".message;
 local jid = require "util.jid";
+local now = require "util.datetime".datetime;
 
 function check_message(data)
 	local origin, stanza = data.origin, data.stanza;
@@ -33,6 +34,7 @@
 
 	local sender = jid.join(target_room, module.host, from_room .. "/" .. from_nick);
 	local forward_stanza = st_msg({from = sender, to = bare_room, type = "groupchat"}, message);
+	forward_stanza:tag("delay", { xmlns = 'urn:xmpp:delay', from = from_room_jid, stamp = now() }):up();
 
 	module:log("debug", "broadcasting message to target room");
 	muc_rooms[bare_room]:broadcast_message(forward_stanza);