Comparison

mod_lastlog/mod_lastlog.lua @ 1176:06e0c279f6a8

mod_lastlog: Import util.datetime
author Kim Alvefur <zash@zash.se>
date Wed, 28 Aug 2013 19:21:00 +0200
parent 1175:9eac4e2386d2
child 1343:7dbde05b48a9
comparison
equal deleted inserted replaced
1175:9eac4e2386d2 1176:06e0c279f6a8
46 }); 46 });
47 end 47 end
48 end); 48 end);
49 49
50 elseif module:get_option_boolean("lastlog_stamp_offline") then 50 elseif module:get_option_boolean("lastlog_stamp_offline") then
51 local datetime = require"util.datetime".datetime;
51 local function offline_stamp(event) 52 local function offline_stamp(event)
52 local stanza = event.stanza; 53 local stanza = event.stanza;
53 local node, to_host = jid.split(stanza.attr.from); 54 local node, to_host = jid.split(stanza.attr.from);
54 if to_host == host and event.origin == hosts[host] and stanza.attr.type == "unavailable" then 55 if to_host == host and event.origin == hosts[host] and stanza.attr.type == "unavailable" then
55 local data = datamanager.load(node, host, "lastlog"); 56 local data = datamanager.load(node, host, "lastlog");
56 local timestamp = data and data.timestamp; 57 local timestamp = data and data.timestamp;
57 if timestamp then 58 if timestamp then
58 stanza:tag("delay", { 59 stanza:tag("delay", {
59 xmlns = "urn:xmpp:delay", 60 xmlns = "urn:xmpp:delay",
60 from = host, 61 from = host,
61 stamp = datetime.datetime(timestamp), 62 stamp = datetime(timestamp),
62 }):up(); 63 }):up();
63 end 64 end
64 end 65 end
65 end 66 end
66 67