Software / code / prosody-modules
Comparison
mod_audit_register/mod_audit_register.lua @ 4938:bc8832c6696b
upstream merge
| author | Goffi <goffi@goffi.org> |
|---|---|
| date | Wed, 11 May 2022 12:44:32 +0200 |
| parent | 4933:08dea42a302a |
| child | 5736:dde83f6043e6 |
comparison
equal
deleted
inserted
replaced
| 4937:3ddab718f717 | 4938:bc8832c6696b |
|---|---|
| 1 module:depends("audit"); | |
| 2 -- luacheck: read globals module.audit | |
| 3 | |
| 4 local st = require "util.stanza"; | |
| 5 | |
| 6 module:hook("user-registered", function(event) | |
| 7 local session = event.session; | |
| 8 local custom = {}; | |
| 9 local invite = event.validated_invite or (event.session and event.session.validated_invite); | |
| 10 if invite then | |
| 11 table.insert(custom, st.stanza( | |
| 12 "invite-used", | |
| 13 { | |
| 14 xmlns = "xmpp:prosody.im/audit", | |
| 15 token = invite.token, | |
| 16 } | |
| 17 )) | |
| 18 end | |
| 19 module:audit(event.username, "user-registered", { | |
| 20 session = session, | |
| 21 custom = custom, | |
| 22 }); | |
| 23 end); |