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)", |