Changeset

1189:63ed3902f357

mod_register: Attach session to user-registered and user-deregistered events
author Matthew Wild <mwild1@gmail.com>
date Thu, 21 May 2009 15:52:20 +0100
parents 1188:fa48e69c4786
children 1191:7f965bd37d65
files plugins/mod_register.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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"));