core/sessionmanager.lua
changeset 12825 a4ac16e5b655
parent 12824 b95771171439
child 12884 b56a2731bf00
equal deleted inserted replaced
12824:b95771171439 12825:a4ac16e5b655
   124 	from_session.log = to_session.log;
   124 	from_session.log = to_session.log;
   125 	from_session.type = to_session.type;
   125 	from_session.type = to_session.type;
   126 	-- Inform xmppstream of the new session (passed to its callbacks)
   126 	-- Inform xmppstream of the new session (passed to its callbacks)
   127 	to_session.stream:set_session(to_session);
   127 	to_session.stream:set_session(to_session);
   128 
   128 
   129 	-- Retire the session we've pulled from, to avoid two sessions on the same connection
   129 	-- Notify modules, allowing them to copy further fields or update state
   130 	retire_session(from_session);
       
   131 
       
   132 	prosody.events.fire_event("c2s-session-updated", {
   130 	prosody.events.fire_event("c2s-session-updated", {
   133 		session = to_session;
   131 		session = to_session;
   134 		from_session = from_session;
   132 		from_session = from_session;
   135 		replaced_conn = replaced_conn;
   133 		replaced_conn = replaced_conn;
   136 	});
   134 	});
       
   135 
       
   136 	-- Retire the session we've pulled from, to avoid two sessions on the same connection
       
   137 	retire_session(from_session);
   137 end
   138 end
   138 
   139 
   139 local function destroy_session(session, err)
   140 local function destroy_session(session, err)
   140 	(session.log or log)("debug", "Destroying session for %s (%s@%s)%s",
   141 	(session.log or log)("debug", "Destroying session for %s (%s@%s)%s",
   141 		session.full_jid or "(unknown)", session.username or "(unknown)",
   142 		session.full_jid or "(unknown)", session.username or "(unknown)",