Comparison

core/moduleapi.lua @ 7342:79a5db780e8b

moduleapi: Allow an origin session to be passed to module:send()
author Kim Alvefur <zash@zash.se>
date Wed, 06 Apr 2016 21:29:30 +0200
parent 7163:eadbf19d0de0
child 7343:1da5a710848d
child 7646:6210dfaec84f
comparison
equal deleted inserted replaced
7340:7dea28dafc49 7342:79a5db780e8b
372 end 372 end
373 item._provided_by = self.name; 373 item._provided_by = self.name;
374 self:add_item(name.."-provider", item); 374 self:add_item(name.."-provider", item);
375 end 375 end
376 376
377 function api:send(stanza) 377 function api:send(stanza, origin)
378 return core_post_stanza(hosts[self.host], stanza); 378 return core_post_stanza(origin or hosts[self.host], stanza);
379 end 379 end
380 380
381 function api:broadcast(jids, stanza, iter) 381 function api:broadcast(jids, stanza, iter)
382 for jid in (iter or it.values)(jids) do 382 for jid in (iter or it.values)(jids) do
383 local new_stanza = st.clone(stanza); 383 local new_stanza = st.clone(stanza);