mod_lastlog: If loaded on a component, store a timestamp of the last message sent, eg to a MUC room
--- 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);