Comparison

plugins/mod_presence.lua @ 1480:93d3295fb064

mod_presence: Send unavailable presence to resources from non-available resources on disconnect
author Waqas Hussain <waqas20@gmail.com>
date Sun, 05 Jul 2009 20:40:31 +0500
parent 1479:eef17ebe3ca1
child 1488:0d1aff918303
comparison
equal deleted inserted replaced
1479:eef17ebe3ca1 1480:93d3295fb064
322 if session.presence then 322 if session.presence then
323 local pres = st.presence{ type = "unavailable" }; 323 local pres = st.presence{ type = "unavailable" };
324 if not(err) or err == "closed" then err = "connection closed"; end 324 if not(err) or err == "closed" then err = "connection closed"; end
325 pres:tag("status"):text("Disconnected: "..err):up(); 325 pres:tag("status"):text("Disconnected: "..err):up();
326 session:dispatch_stanza(pres); 326 session:dispatch_stanza(pres);
327 elseif session.directed then
328 local pres = st.presence{ type = "unavailable" };
329 if not(err) or err == "closed" then err = "connection closed"; end
330 pres:tag("status"):text("Disconnected: "..err):up();
331 for jid in pairs(session.directed) do
332 pres.attr.to = jid;
333 core_route_stanza(session, pres);
334 end
335 session.directed = nil;
327 end 336 end
328 end); 337 end);