# HG changeset patch # User Waqas Hussain # Date 1234796703 -18000 # Node ID 863046d84b566fcbfb42a27efb176b9815914498 # Parent 09d6b5fadc84804abb5361672be969badba7934a MUC: Private stanzas (private messages, IQs, etc) diff -r 09d6b5fadc84 -r 863046d84b56 plugins/mod_muc.lua --- a/plugins/mod_muc.lua Mon Feb 16 19:39:10 2009 +0500 +++ b/plugins/mod_muc.lua Mon Feb 16 20:05:03 2009 +0500 @@ -327,11 +327,19 @@ elseif type ~= 'result' then -- bad type origin.send(st.error_reply(stanza, "modify", "bad-request")); -- FIXME correct error? end + elseif not current_nick then -- not in room + origin.send(st.error_reply(stanza, "cancel", "not-acceptable")); elseif stanza.name == "message" and type == "groupchat" then -- groupchat messages not allowed in PM origin.send(st.error_reply(stanza, "modify", "bad-request")); - else - origin.send(st.error_reply(stanza, "cancel", "not-implemented", "Private stanzas not implemented")); -- TODO route private stanza + else -- private stanza + local o_data = rooms:get(room, to); + if o_data then + stanza.attr.to, stanza.attr.from = o_data.jid, current_nick; + core_route_stanza(component, stanza); + else -- recipient not in room + origin.send(st.error_reply(stanza, "cancel", "item-not-found", "Recipient not in room")); + end end end