aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_muc.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-02-16 20:05:03 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-02-16 20:05:03 +0500
commite635b213dfa37d9b122177f2699b6e8a0079968d (patch)
treed86623da29ede5b80023e8a5fafe6d51b1616123 /plugins/mod_muc.lua
parent2fe7662497702e59a0c35e8b0cbca8f53102133e (diff)
downloadprosody-e635b213dfa37d9b122177f2699b6e8a0079968d.tar.gz
prosody-e635b213dfa37d9b122177f2699b6e8a0079968d.zip
MUC: Private stanzas (private messages, IQs, etc)
Diffstat (limited to 'plugins/mod_muc.lua')
-rw-r--r--plugins/mod_muc.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_muc.lua b/plugins/mod_muc.lua
index 78271472..7c6d283c 100644
--- a/plugins/mod_muc.lua
+++ b/plugins/mod_muc.lua
@@ -327,11 +327,19 @@ function handle_to_occupant(origin, stanza) -- PM, vCards, etc
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