Comparison

core/sessionmanager.lua @ 1479:eef17ebe3ca1

Moved automatic unavailable presence generation on disconnect from sessionmanager to mod_presence
author Waqas Hussain <waqas20@gmail.com>
date Sun, 05 Jul 2009 17:45:44 +0500
parent 1478:da11f2652ae9
child 1523:841d61be198f
comparison
equal deleted inserted replaced
1478:da11f2652ae9 1479:eef17ebe3ca1
53 return session; 53 return session;
54 end 54 end
55 55
56 function destroy_session(session, err) 56 function destroy_session(session, err)
57 (session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)"); 57 (session.log or log)("info", "Destroying session for %s (%s@%s)", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)");
58
59 -- Send unavailable presence
60 if session.presence then
61 local pres = st.presence{ type = "unavailable" };
62 if (not err) or err == "closed" then err = "connection closed"; end
63 pres:tag("status"):text("Disconnected: "..err):up();
64 session:dispatch_stanza(pres);
65 end
66 58
67 -- Remove session/resource from user's session list 59 -- Remove session/resource from user's session list
68 if session.full_jid then 60 if session.full_jid then
69 hosts[session.host].events.fire_event("resource-unbind", {session=session, error=err}); 61 hosts[session.host].events.fire_event("resource-unbind", {session=session, error=err});
70 62