# HG changeset patch # User Matthew Wild # Date 1242917540 -3600 # Node ID 63ed3902f3570fab1a4546c55f6939bae9c20883 # Parent fa48e69c4786f089eaa3e0838cb857cf69081b55 mod_register: Attach session to user-registered and user-deregistered events diff -r fa48e69c4786 -r 63ed3902f357 plugins/mod_register.lua --- a/plugins/mod_register.lua Wed May 20 05:23:30 2009 +0500 +++ b/plugins/mod_register.lua Thu May 21 15:52:20 2009 +0100 @@ -61,7 +61,7 @@ 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" }); + module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session }); else local username = query:child_with_name("username"); local password = query:child_with_name("password"); @@ -147,7 +147,8 @@ 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" }); + username = username, host = session.host, source = "mod_register", + session = session }); 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"));