Merge 0.9->trunk
[prosody.git] / plugins / muc / mod_muc.lua
index 7861092c40598dfa7aabbbb2780d5c580732db08..bc865ec92d4f55c6011f285555333b4e0dbcef35 100644 (file)
@@ -83,6 +83,7 @@ function create_room(jid)
        room.route_stanza = room_route_stanza;
        room.save = room_save;
        rooms[jid] = room;
+       module:fire_event("muc-room-created", { room = room });
        return room;
 end
 
@@ -114,7 +115,7 @@ end
 local function get_disco_items(stanza)
        local reply = st.iq({type='result', id=stanza.attr.id, from=muc_host, to=stanza.attr.from}):query("http://jabber.org/protocol/disco#items");
        for jid, room in pairs(rooms) do
-               if not room:is_hidden() then
+               if not room:get_hidden() then
                        reply:tag("item", {jid=jid, name=room:get_name()}):up();
                end
        end
@@ -218,7 +219,8 @@ function shutdown_component()
        if not saved then
                local stanza = st.presence({type = "unavailable"})
                        :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"})
-                               :tag("item", { affiliation='none', role='none' }):up();
+                               :tag("item", { affiliation='none', role='none' }):up()
+                               :tag("status", { code = "332"}):up();
                for roomjid, room in pairs(rooms) do
                        shutdown_room(room, stanza);
                end