Comparison

plugins/mod_presence.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 1477:e0411d6c9bae
child 1480:93d3295fb064
comparison
equal deleted inserted replaced
1478:da11f2652ae9 1479:eef17ebe3ca1
313 -- TODO fire post processing event 313 -- TODO fire post processing event
314 session.send(stanza); 314 session.send(stanza);
315 end -- resource not online, discard 315 end -- resource not online, discard
316 return true; 316 return true;
317 end); 317 end);
318
319 module:hook("resource-unbind", function(event)
320 local session, err = event.session, event.error;
321 -- Send unavailable presence
322 if session.presence then
323 local pres = st.presence{ type = "unavailable" };
324 if not(err) or err == "closed" then err = "connection closed"; end
325 pres:tag("status"):text("Disconnected: "..err):up();
326 session:dispatch_stanza(pres);
327 end
328 end);