Changeset

826:27978a3f2c0c

core.presencemanager: Set 'from' attribute on outgoing unavailable directed presences
author Matthew Wild <mwild1@gmail.com>
date Thu, 19 Feb 2009 19:00:18 +0000
parents 825:6d619c43e613
children 827:e74045238ee3
files core/presencemanager.lua
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/core/presencemanager.lua	Thu Feb 19 15:18:44 2009 +0000
+++ b/core/presencemanager.lua	Thu Feb 19 19:00:18 2009 +0000
@@ -95,13 +95,16 @@
 		end
 		origin.priority = 0;
 		if stanza.attr.type == "unavailable" then
-			origin.presence = nil;
-			if origin.directed then
-				for jid in pairs(origin.directed) do
-					stanza.attr.to = jid;
-					core_route_stanza(origin, stanza);
-				end
-				origin.directed = nil;
+			origin.presence = nil;
+			if origin.directed then
+				local old_from = stanza.attr.from;
+				stanza.attr.from = origin.full_jid;
+				for jid in pairs(origin.directed) do
+					stanza.attr.to = jid;
+					core_route_stanza(origin, stanza);
+				end
+				stanza.attr.from = old_from;
+				origin.directed = nil;
 			end
 		else
 			origin.presence = stanza;