Software /
code /
prosody
Comparison
net/xmppclient_listener.lua @ 135:bf10d42dd41b
Merged from Matthew
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 23 Oct 2008 21:51:00 +0500 |
parent | 123:ebd65feb188c |
child | 148:4c0dcd245d34 |
comparison
equal
deleted
inserted
replaced
134:b772317ea1ee | 135:bf10d42dd41b |
---|---|
67 session.data(conn, data); | 67 session.data(conn, data); |
68 end | 68 end |
69 end | 69 end |
70 | 70 |
71 function xmppclient.disconnect(conn) | 71 function xmppclient.disconnect(conn) |
72 local session = sessions[conn]; | |
73 if session then | |
74 if session.last_presence and session.last_presence.attr.type ~= "unavailable" then | |
75 local pres = st.presence{ type = "unavailable" }; | |
76 if err == "closed" then err = "connection closed"; end | |
77 pres:tag("status"):text("Disconnected: "..err); | |
78 session.stanza_dispatch(pres); | |
79 end | |
80 sm_destroy_session(session); | |
81 sessions[conn] = nil; | |
82 session = nil; | |
83 collectgarbage("collect"); | |
84 end | |
72 end | 85 end |
73 | 86 |
74 connlisteners_register("xmppclient", xmppclient); | 87 connlisteners_register("xmppclient", xmppclient); |