mod_dialback: Move d-w-d after to/from validation
[prosody.git] / plugins / muc / muc.lib.lua
index 462d6893dc833b30515aaaf6d2ea09c9641535e4..8cf8d882e5895962a2a3e779267a52e9d6cc4e46 100644 (file)
@@ -570,6 +570,7 @@ function room_mt:handle_to_occupant(origin, stanza) -- PM, vCards, etc
                                end
                                stanza.attr.from, stanza.attr.to, stanza.attr.id = from, to, id;
                        else -- message
+                               stanza:tag("x", { xmlns = "http://jabber.org/protocol/muc#user" }):up();
                                stanza.attr.from = current_nick;
                                for jid in pairs(o_data.sessions) do
                                        stanza.attr.to = jid;
@@ -1031,7 +1032,7 @@ function room_mt:can_set_role(actor_jid, occupant_jid, role)
        if actor_jid == true then return true; end
 
        local actor = self._occupants[self._jid_nick[actor_jid]];
-       if actor.role == "moderator" then
+       if actor and actor.role == "moderator" then
                if occupant.affiliation ~= "owner" and occupant.affiliation ~= "admin" then
                        if actor.affiliation == "owner" or actor.affiliation == "admin" then
                                return true;