MUC: Split out handling of the room-creating presence into its own method
[prosody.git] / plugins / muc / mod_muc.lua
index be34c652e3b62a668eed2b3cefdf4c18f1332f13..657823383481f95abe63c31c45a746d331970ab2 100644 (file)
@@ -203,7 +203,7 @@ module:hook("host-disco-items", function(event)
                for room in each_room() do
                        if not room:get_hidden() then
                                local jid, room_name = room.jid, room:get_name();
-                               room_items_cache[jid] = name;
+                               room_items_cache[jid] = room_name;
                                reply:tag("item", { jid = jid, name = room_name }):up();
                        end
                end
@@ -273,6 +273,7 @@ for event_name, method in pairs {
                        -- Watch presence to create rooms
                        if stanza.attr.type == nil and stanza.name == "presence" then
                                room = muclib.new_room(room_jid);
+                               return room:handle_first_presence(origin, stanza);
                        elseif stanza.attr.type ~= "error" then
                                origin.send(st.error_reply(stanza, "cancel", "not-allowed"));
                                return true;