Merge 0.10->trunk
authorMatthew Wild <mwild1@gmail.com>
Wed, 6 May 2015 18:26:53 +0000 (19:26 +0100)
committerMatthew Wild <mwild1@gmail.com>
Wed, 6 May 2015 18:26:53 +0000 (19:26 +0100)
1  2 
core/moduleapi.lua
core/storagemanager.lua
plugins/mod_s2s/mod_s2s.lua

index 9845c227971d092067e1296cbe46c3d017dedc17,0cb1f1e7f13a552bb532a6d82cfc1ad761101432..bb8021958219bc74537864336d86ed26e207f8a7
@@@ -364,29 -365,19 +367,37 @@@ function api:send(stanza
        return core_post_stanza(hosts[self.host], stanza);
  end
  
 -function api:add_timer(delay, callback)
 -      return timer.add_task(delay, function (t)
 -              if self.loaded == false then return; end
 -              return callback(t);
 -      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
 +local timer_methods = { }
 +local timer_mt = {
 +      __index = timer_methods;
 +}
 +function timer_methods:stop( )
 +      timer.stop(self.id);
 +end
 +timer_methods.disarm = timer_methods.stop
 +function timer_methods:reschedule(delay)
 +      timer.reschedule(self.id, delay)
 +end
 +
 +local function timer_callback(now, id, t)
 +      if t.module_env.loaded == false then return; end
 +      return t.callback(now, unpack(t, 1, t.n));
 +end
 +
 +function api:add_timer(delay, callback, ...)
 +      local t = pack(...)
 +      t.module_env = self;
 +      t.callback = callback;
 +      t.id = timer.add_task(delay, timer_callback, t);
 +      return setmetatable(t, timer_mt);
  end
  
  local path_sep = package.config:sub(1,1);
Simple merge
Simple merge