Comparison

plugins/mod_bosh.lua @ 8493:d424fe42b4d2

mod_bosh: Use module API to fire events
author Kim Alvefur <zash@zash.se>
date Wed, 13 Dec 2017 17:31:31 +0100
parent 8492:2dd07828ede1
child 8523:30671b378ab5
comparison
equal deleted inserted replaced
8492:2dd07828ede1 8493:d424fe42b4d2
324 local filter = initialize_filters(session); 324 local filter = initialize_filters(session);
325 325
326 session.log("debug", "BOSH session created for request from %s", session.ip); 326 session.log("debug", "BOSH session created for request from %s", session.ip);
327 log("info", "New BOSH session, assigned it sid '%s'", sid); 327 log("info", "New BOSH session, assigned it sid '%s'", sid);
328 328
329 hosts[session.host].events.fire_event("bosh-session", { session = session, request = request }); 329 module:fire_event("bosh-session", { session = session, request = request });
330 330
331 -- Send creation response 331 -- Send creation response
332 local creating_session = true; 332 local creating_session = true;
333 333
334 local r = session.requests; 334 local r = session.requests;
425 context.sid = sid; 425 context.sid = sid;
426 session.bosh_processing = true; -- Used to suppress replies until processing of this request is done 426 session.bosh_processing = true; -- Used to suppress replies until processing of this request is done
427 427
428 if session.notopen then 428 if session.notopen then
429 local features = st.stanza("stream:features"); 429 local features = st.stanza("stream:features");
430 hosts[session.host].events.fire_event("stream-features", { origin = session, features = features }); 430 module:fire_event("stream-features", { origin = session, features = features });
431 session.send(features); 431 session.send(features);
432 session.notopen = nil; 432 session.notopen = nil;
433 end 433 end
434 end 434 end
435 435