Diff

core/stanza_router.lua @ 642:0ae8584ba3e7

More error replies for offline and non-existing users
author Waqas Hussain <waqas20@gmail.com>
date Thu, 25 Dec 2008 05:16:11 +0500
parent 641:658a2de74afc
child 667:4f4d94253547
line wrap: on
line diff
--- a/core/stanza_router.lua	Thu Dec 25 04:58:15 2008 +0500
+++ b/core/stanza_router.lua	Thu Dec 25 05:16:11 2008 +0500
@@ -229,7 +229,7 @@
 					else
 						-- TODO send unavailable presence or unsubscribed
 					end
-				elseif stanza.name == "message" then
+				elseif stanza.name == "message" then -- FIXME if full jid, then send out to resources with highest priority
 					if stanza.attr.type == "chat" or stanza.attr.type == "normal" or not stanza.attr.type then
 						offlinemanager.store(node, host, stanza);
 						-- FIXME don't store messages with only chat state notifications
@@ -237,12 +237,13 @@
 					-- TODO allow configuration of offline storage
 					-- TODO send error if not storing offline
 				elseif stanza.name == "iq" then
-					-- TODO send IQ error
+					origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 				end
 			else -- user does not exist
 				-- TODO we would get here for nodeless JIDs too. Do something fun maybe? Echo service? Let plugins use xmpp:server/resource addresses?
 				if stanza.name == "presence" then
-					if stanza.attr.type == "probe" then
+					local t = stanza.attr.type;
+					if t == "subscribe" or t == "probe" then
 						origin.send(st.presence({from = to_bare, to = from_bare, type = "unsubscribed"}));
 					end
 					-- else ignore