Comparison

core/moduleapi.lua @ 4614:20940729c1b4

moduleapi: Add module:send() as an alias for core_post_stanza() from the current host's origin
author Matthew Wild <mwild1@gmail.com>
date Thu, 15 Mar 2012 02:53:05 +0000
parent 4613:27fbc9c69eb5
child 4651:d1739d72100a
comparison
equal deleted inserted replaced
4613:27fbc9c69eb5 4614:20940729c1b4
20 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack; 20 local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack;
21 local tonumber, tostring = tonumber, tostring; 21 local tonumber, tostring = tonumber, tostring;
22 22
23 local prosody = prosody; 23 local prosody = prosody;
24 local hosts = prosody.hosts; 24 local hosts = prosody.hosts;
25 local core_post_stanza = prosody.core_post_stanza;
25 26
26 -- Registry of shared module data 27 -- Registry of shared module data
27 local shared_data = setmetatable({}, { __mode = "v" }); 28 local shared_data = setmetatable({}, { __mode = "v" });
28 29
29 local NULL = {}; 30 local NULL = {};
304 item.name = item_name; 305 item.name = item_name;
305 end 306 end
306 self:add_item(name, item); 307 self:add_item(name, item);
307 end 308 end
308 309
310 function api:send(stanza)
311 return core_post_stanza(hosts[self.host], stanza);
312 end
313
309 return api; 314 return api;