From c33e8699c02ea861669e607e6fe1725db4822f1f Mon Sep 17 00:00:00 2001
From: Waqas Hussain <waqas20@gmail.com>
Date: Wed, 1 Aug 2012 01:36:11 +0500
Subject: MUC: Return <item-not-found/> on message and iq to non-existent rooms
 (thanks Maranda).

---
 plugins/muc/mod_muc.lua | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'plugins')

diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index 0fa172ee..7312157c 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -135,6 +135,10 @@ function stanza_handler(event)
 	local bare = jid_bare(stanza.attr.to);
 	local room = rooms[bare];
 	if not room then
+		if stanza.name ~= "presence" then
+			origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
+			return true;
+		end
 		if not(restrict_room_creation) or
 		  (restrict_room_creation == "admin" and is_admin(stanza.attr.from)) or
 		  (restrict_room_creation == "local" and select(2, jid_split(stanza.attr.from)) == module.host:gsub("^[^%.]+%.", "")) then
-- 
cgit v1.2.3