Comparison

plugins/muc/muc.lib.lua @ 4999:d5a3c5c1873c

mod_muc: Fix a couple of cases of 'forbidden' stanza error being sent with type 'cancel' - fixes #303
author Matthew Wild <mwild1@gmail.com>
date Tue, 24 Jul 2012 10:44:37 +0100
parent 4876:fa41d05ee7ef
child 5061:186f34d88073
comparison
equal deleted inserted replaced
4998:f6c1f98419be 4999:d5a3c5c1873c
854 local current_nick = self._jid_nick[from]; 854 local current_nick = self._jid_nick[from];
855 local occupant = self._occupants[current_nick]; 855 local occupant = self._occupants[current_nick];
856 if not occupant then -- not in room 856 if not occupant then -- not in room
857 origin.send(st.error_reply(stanza, "cancel", "not-acceptable")); 857 origin.send(st.error_reply(stanza, "cancel", "not-acceptable"));
858 elseif occupant.role == "visitor" then 858 elseif occupant.role == "visitor" then
859 origin.send(st.error_reply(stanza, "cancel", "forbidden")); 859 origin.send(st.error_reply(stanza, "auth", "forbidden"));
860 else 860 else
861 local from = stanza.attr.from; 861 local from = stanza.attr.from;
862 stanza.attr.from = current_nick; 862 stanza.attr.from = current_nick;
863 local subject = getText(stanza, {"subject"}); 863 local subject = getText(stanza, {"subject"});
864 if subject then 864 if subject then
865 if occupant.role == "moderator" or 865 if occupant.role == "moderator" or
866 ( self._data.changesubject and occupant.role == "participant" ) then -- and participant 866 ( self._data.changesubject and occupant.role == "participant" ) then -- and participant
867 self:set_subject(current_nick, subject); -- TODO use broadcast_message_stanza 867 self:set_subject(current_nick, subject); -- TODO use broadcast_message_stanza
868 else 868 else
869 stanza.attr.from = from; 869 stanza.attr.from = from;
870 origin.send(st.error_reply(stanza, "cancel", "forbidden")); 870 origin.send(st.error_reply(stanza, "auth", "forbidden"));
871 end 871 end
872 else 872 else
873 self:broadcast_message(stanza, self:get_historylength() > 0); 873 self:broadcast_message(stanza, self:get_historylength() > 0);
874 end 874 end
875 stanza.attr.from = from; 875 stanza.attr.from = from;