MUC: Use correct room name variable, fixes traceback (thanks mathieui)
[prosody.git] / plugins / muc / mod_muc.lua
index 8613ab06f8e58339b8d3276c6bb8a76181061247..14b716e14a204393190b0e79f97064ecedf35dc3 100644 (file)
@@ -180,7 +180,7 @@ function each_room(local_only)
                        seen[room.jid] = true;
                end
                for room_jid in pairs(persistent_rooms_storage:get(nil) or {}) do
-                       if seen[room_jid] then
+                       if not seen[room_jid] then
                                local room = restore_room(room_jid);
                                if room == nil then
                                        module:log("error", "Missing data for room '%s', omitting from iteration", room_jid);
@@ -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
@@ -285,10 +285,8 @@ for event_name, method in pairs {
 end
 
 function shutdown_component()
-       local x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"})
-               :tag("status", { code = "332"}):up();
        for room in each_room(true) do
-               room:clear(x);
+               room:save(true);
        end
 end
 module:hook_global("server-stopping", shutdown_component);