Comparison

plugins/mod_muc.lua @ 779:ec0eadf4e9ff

Changed mod_muc to work with changed component manager
author Waqas Hussain <waqas20@gmail.com>
date Wed, 11 Feb 2009 18:07:20 +0500
parent 757:f77843f31c7d
child 782:6f9b2a9d6d45
comparison
equal deleted inserted replaced
778:0d94b4903cc7 779:ec0eadf4e9ff
264 else 264 else
265 origin.send(st.error_reply(stanza, "cancel", "service-unavailable", "The muc server doesn't deal with messages and presence directed at it")); 265 origin.send(st.error_reply(stanza, "cancel", "service-unavailable", "The muc server doesn't deal with messages and presence directed at it"));
266 end 266 end
267 end 267 end
268 268
269 function handle_stanza(origin, stanza) 269 register_component(muc_domain, function(origin, stanza)
270 local to_node, to_host, to_resource = jid_split(stanza.attr.to); 270 local to_node, to_host, to_resource = jid_split(stanza.attr.to);
271 if stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then 271 if stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then
272 if type == "error" or type == "result" then return; end 272 if type == "error" or type == "result" then return; end
273 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME what's appropriate? 273 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); -- FIXME what's appropriate?
274 elseif to_resource and not to_node then 274 elseif to_resource and not to_node then
280 handle_to_room(origin, stanza) 280 handle_to_room(origin, stanza)
281 else -- to the main muc domain 281 else -- to the main muc domain
282 if type == "error" or type == "result" then return; end 282 if type == "error" or type == "result" then return; end
283 handle_to_domain(origin, stanza); 283 handle_to_domain(origin, stanza);
284 end 284 end
285 end 285 end);
286
287 module.load_component = function()
288 return handle_stanza; -- Return the function that we want to handle incoming stanzas
289 end
290 286
291 module.unload = function() 287 module.unload = function()
292 deregister_component(muc_domain); 288 deregister_component(muc_domain);
293 end 289 end
294 module.save = function() 290 module.save = function()