Comparison

plugins/mod_muc.lua @ 811:863046d84b56

MUC: Private stanzas (private messages, IQs, etc)
author Waqas Hussain <waqas20@gmail.com>
date Mon, 16 Feb 2009 20:05:03 +0500
parent 810:09d6b5fadc84
child 812:1dbcf57154bd
comparison
equal deleted inserted replaced
810:09d6b5fadc84 811:863046d84b56
325 end 325 end
326 end 326 end
327 elseif type ~= 'result' then -- bad type 327 elseif type ~= 'result' then -- bad type
328 origin.send(st.error_reply(stanza, "modify", "bad-request")); -- FIXME correct error? 328 origin.send(st.error_reply(stanza, "modify", "bad-request")); -- FIXME correct error?
329 end 329 end
330 elseif not current_nick then -- not in room
331 origin.send(st.error_reply(stanza, "cancel", "not-acceptable"));
330 elseif stanza.name == "message" and type == "groupchat" then 332 elseif stanza.name == "message" and type == "groupchat" then
331 -- groupchat messages not allowed in PM 333 -- groupchat messages not allowed in PM
332 origin.send(st.error_reply(stanza, "modify", "bad-request")); 334 origin.send(st.error_reply(stanza, "modify", "bad-request"));
333 else 335 else -- private stanza
334 origin.send(st.error_reply(stanza, "cancel", "not-implemented", "Private stanzas not implemented")); -- TODO route private stanza 336 local o_data = rooms:get(room, to);
337 if o_data then
338 stanza.attr.to, stanza.attr.from = o_data.jid, current_nick;
339 core_route_stanza(component, stanza);
340 else -- recipient not in room
341 origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Recipient not in room"));
342 end
335 end 343 end
336 end 344 end
337 345
338 function handle_to_room(origin, stanza) -- presence changes and groupchat messages, along with disco/etc 346 function handle_to_room(origin, stanza) -- presence changes and groupchat messages, along with disco/etc
339 local type = stanza.attr.type; 347 local type = stanza.attr.type;