Software /
code /
prosody
Changeset
1184:fa6df7e83fb3
mod_register: Fire events and log on account creation/deletion
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 19 May 2009 11:53:34 +0100 |
parents | 1183:565e16ee0c74 |
children | 1185:c68ccb7faeaf |
files | plugins/mod_register.lua |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_register.lua Tue May 19 11:50:22 2009 +0100 +++ b/plugins/mod_register.lua Tue May 19 11:53:34 2009 +0100 @@ -60,6 +60,8 @@ end end datamanager.store(username, host, "accounts", nil); -- delete accounts datastore at the end + module:log("info", "User removed their account: %s@%s", username, host); + module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register" }); else local username = query:child_with_name("username"); local password = query:child_with_name("password"); @@ -143,6 +145,9 @@ else if usermanager_create_user(username, password, session.host) then session.send(st.reply(stanza)); -- user created! + module:log("info", "User account created: %s@%s", username, session.host); + module:fire_event("user-registered", { + username = username, host = session.host, source = "mod_register" }); else -- TODO unable to write file, file may be locked, etc, what's the correct error? session.send(st.error_reply(stanza, "wait", "internal-server-error"));