Diff

core/stanza_router.lua @ 784:1de8a32f81e9

Change the to attribute of messages to the recipients' bare JID when the recipient/resource is offline.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 11 Feb 2009 23:26:18 +0500
parent 783:defb0119f80f
child 785:31d5be1371cf
line wrap: on
line diff
--- a/core/stanza_router.lua	Wed Feb 11 23:16:14 2009 +0500
+++ b/core/stanza_router.lua	Wed Feb 11 23:26:18 2009 +0500
@@ -210,10 +210,10 @@
 						end
 					end
 				elseif stanza.name == "message" then -- select a resource to recieve message
-					if message.attr.type == 'headline' then
+					stanza.attr.to = to_bare;
+					if stanza.attr.type == 'headline' then
 						for _, session in pairs(user.sessions) do -- find resource with greatest priority
 							if session.presence and session.priority >= 0 then
-								stanza.attr.to = session.full_jid;
 								session.send(stanza);
 							end
 						end
@@ -259,6 +259,7 @@
 						-- TODO send unavailable presence or unsubscribed
 					end
 				elseif stanza.name == "message" then -- FIXME if full jid, then send out to resources with highest priority
+					stanza.attr.to = to_bare; -- TODO not in RFC, but seems obvious. Should discuss on the mailing list.
 					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