825 end |
825 end |
826 self:set_persistent(false); |
826 self:set_persistent(false); |
827 module:fire_event("muc-room-destroyed", { room = self }); |
827 module:fire_event("muc-room-destroyed", { room = self }); |
828 end |
828 end |
829 |
829 |
|
830 function room_mt:handle_disco_info_get_query(origin, stanza) |
|
831 origin.send(self:get_disco_info(stanza)); |
|
832 return true; |
|
833 end |
|
834 |
|
835 function room_mt:handle_disco_items_get_query(origin, stanza) |
|
836 origin.send(self:get_disco_items(stanza)); |
|
837 return true; |
|
838 end |
|
839 |
830 function room_mt:handle_admin_item_set_command(origin, stanza) |
840 function room_mt:handle_admin_item_set_command(origin, stanza) |
831 local item = stanza.tags[1].tags[1]; |
841 local item = stanza.tags[1].tags[1]; |
832 if item.attr.jid then -- Validate provided JID |
842 if item.attr.jid then -- Validate provided JID |
833 item.attr.jid = jid_prep(item.attr.jid); |
843 item.attr.jid = jid_prep(item.attr.jid); |
834 if not item.attr.jid then |
844 if not item.attr.jid then |
949 |
959 |
950 function room_mt:handle_iq_to_room(origin, stanza) |
960 function room_mt:handle_iq_to_room(origin, stanza) |
951 local type = stanza.attr.type; |
961 local type = stanza.attr.type; |
952 local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns; |
962 local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns; |
953 if xmlns == "http://jabber.org/protocol/disco#info" and type == "get" and not stanza.tags[1].attr.node then |
963 if xmlns == "http://jabber.org/protocol/disco#info" and type == "get" and not stanza.tags[1].attr.node then |
954 origin.send(self:get_disco_info(stanza)); |
964 return self:handle_disco_info_get_query(origin, stanza) |
955 return true; |
|
956 elseif xmlns == "http://jabber.org/protocol/disco#items" and type == "get" and not stanza.tags[1].attr.node then |
965 elseif xmlns == "http://jabber.org/protocol/disco#items" and type == "get" and not stanza.tags[1].attr.node then |
957 origin.send(self:get_disco_items(stanza)); |
966 return self:handle_disco_items_get_query(origin, stanza) |
958 return true; |
|
959 elseif xmlns == "http://jabber.org/protocol/muc#admin" then |
967 elseif xmlns == "http://jabber.org/protocol/muc#admin" then |
960 local item = stanza.tags[1].tags[1]; |
968 local item = stanza.tags[1].tags[1]; |
961 if item and item.name == "item" then |
969 if item and item.name == "item" then |
962 if type == "set" then |
970 if type == "set" then |
963 return self:handle_admin_item_set_command(origin, stanza) |
971 return self:handle_admin_item_set_command(origin, stanza) |