diff options
author | daurnimator <quae@daurnimator.com> | 2014-04-03 16:04:04 -0400 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2014-04-03 16:04:04 -0400 |
commit | d8832205ef2728e337ff016a71b96e3aaffea912 (patch) | |
tree | 03142db6df6242ecaa0f6b2709218a231ab71949 /plugins/muc/muc.lib.lua | |
parent | fbb58db35976fbee12a7202f50a554bcfe257c7e (diff) | |
download | prosody-d8832205ef2728e337ff016a71b96e3aaffea912.tar.gz prosody-d8832205ef2728e337ff016a71b96e3aaffea912.zip |
plugins/muc/muc.lib: Move occupancy check to later in `deconstruct_stanza_id`: As vcards are from the bare jid, you need to use the `from_jid` out of the encoded `id`
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r-- | plugins/muc/muc.lib.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 89953615..694e13ff 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -622,13 +622,14 @@ function room_mt:handle_iq_to_occupant(origin, stanza) local from, to = stanza.attr.from, stanza.attr.to; local type = stanza.attr.type; local id = stanza.attr.id; - local current_nick = self:get_occupant_jid(from); local occupant = self:get_occupant_by_nick(to); if (type == "error" or type == "result") then do -- deconstruct_stanza_id - if not current_nick or not occupant then return nil; end + if not occupant then return nil; end local from_jid, id, to_jid_hash = (base64.decode(stanza.attr.id) or ""):match("^(.+)%z(.*)%z(.+)$"); if not(from == from_jid or from == jid_bare(from_jid)) then return nil; end + local from_occupant_jid = self:get_occupant_jid(from_jid); + if from_occupant_jid == nil then return nil; end local session_jid for to_jid in occupant:each_session() do if md5(to_jid) == to_jid_hash then @@ -637,13 +638,14 @@ function room_mt:handle_iq_to_occupant(origin, stanza) end end if session_jid == nil then return nil; end - stanza.attr.from, stanza.attr.to, stanza.attr.id = current_nick, session_jid, id + stanza.attr.from, stanza.attr.to, stanza.attr.id = from_jid, session_jid, id; end log("debug", "%s sent private iq stanza to %s (%s)", from, to, stanza.attr.to); self:route_stanza(stanza); stanza.attr.from, stanza.attr.to, stanza.attr.id = from, to, id; return true; else -- Type is "get" or "set" + local current_nick = self:get_occupant_jid(from); if not current_nick then origin.send(st.error_reply(stanza, "cancel", "not-acceptable")); return true; |