# HG changeset patch # User Kim Alvefur # Date 1377708840 -7200 # Node ID bd7901fef71b2af52ccdcd047a2b1013b13f6016 # Parent 8999967fc4fefe60f6f3ecd93cdc20e3ab784b26 mod_lastlog: If loaded on a component, store a timestamp of the last message sent, eg to a MUC room diff -r 8999967fc4fe -r bd7901fef71b mod_lastlog/mod_lastlog.lua --- a/mod_lastlog/mod_lastlog.lua Wed Aug 28 18:46:06 2013 +0200 +++ b/mod_lastlog/mod_lastlog.lua Wed Aug 28 18:54:00 2013 +0200 @@ -35,7 +35,19 @@ }); end); -if module:get_option_boolean("lastlog_stamp_offline") then + +if module:get_host_type() == "component" then + module:hook("message/bare", function(event) + local room = split_jid(event.stanza.attr.to); + if room then + datamanager.store(room, module.host, "lastlog", { + event = "message"; + timestamp = time(), + }); + end + end); + +elseif module:get_option_boolean("lastlog_stamp_offline") then local function offline_stamp(event) local stanza = event.stanza; local node, to_host = jid.split(stanza.attr.from);