core/moduleapi.lua
changeset 6654 deaa3d66dc2c
parent 6643 859e9af53aa1
child 6655 06116b2789f0
--- a/core/moduleapi.lua	Tue Apr 28 14:19:28 2015 +0100
+++ b/core/moduleapi.lua	Wed May 06 18:37:46 2015 +0100
@@ -10,6 +10,7 @@
 local modulemanager; -- This gets set from modulemanager
 local array = require "util.array";
 local set = require "util.set";
+local it = require "util.iterators";
 local logger = require "util.logger";
 local pluginloader = require "util.pluginloader";
 local timer = require "util.timer";
@@ -362,6 +363,14 @@
 	return core_post_stanza(hosts[self.host], stanza);
 end
 
+function api:broadcast(jids, stanza, iter)
+	for jid in (iter or it.values)(jids) do
+		local new_stanza = st.clone(stanza);
+		new_stanza.attr.to = jid;
+		core_post_stanza(hosts[self.host], new_stanza);
+	end
+end
+
 function api:add_timer(delay, callback)
 	return timer.add_task(delay, function (t)
 		if self.loaded == false then return; end