Mercurial > prosody-modules
comparison mod_lastlog/mod_lastlog.lua @ 1173:8999967fc4fe
mod_lastlog: Collect timestamp on registration
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 28 Aug 2013 18:46:06 +0200 |
| parents | 1e8b793d8ff9 |
| children | bd7901fef71b |
comparison
equal
deleted
inserted
replaced
| 1172:1e8b793d8ff9 | 1173:8999967fc4fe |
|---|---|
| 22 event = "logout"; | 22 event = "logout"; |
| 23 timestamp = time(), | 23 timestamp = time(), |
| 24 ip = log_ip and session.ip or nil, | 24 ip = log_ip and session.ip or nil, |
| 25 }); | 25 }); |
| 26 end | 26 end |
| 27 end); | |
| 28 | |
| 29 module:hook("user-registered", function(event) | |
| 30 local session = event.session; | |
| 31 datamanager.store(event.username, host, "lastlog", { | |
| 32 event = "registered"; | |
| 33 timestamp = time(), | |
| 34 ip = log_ip and session.ip or nil, | |
| 35 }); | |
| 27 end); | 36 end); |
| 28 | 37 |
| 29 if module:get_option_boolean("lastlog_stamp_offline") then | 38 if module:get_option_boolean("lastlog_stamp_offline") then |
| 30 local function offline_stamp(event) | 39 local function offline_stamp(event) |
| 31 local stanza = event.stanza; | 40 local stanza = event.stanza; |
