aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-02-19 19:00:18 +0000
committerMatthew Wild <mwild1@gmail.com>2009-02-19 19:00:18 +0000
commit412368f62ac29b4880f14c26372806a32b2bb4ae (patch)
tree6ab012f5a2fd19df4c798d296942a1fa6d13de99 /core
parentec92f62650b73c4fe87f61f9e4b68246239fc017 (diff)
downloadprosody-412368f62ac29b4880f14c26372806a32b2bb4ae.tar.gz
prosody-412368f62ac29b4880f14c26372806a32b2bb4ae.zip
core.presencemanager: Set 'from' attribute on outgoing unavailable directed presences
Diffstat (limited to 'core')
-rw-r--r--core/presencemanager.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/core/presencemanager.lua b/core/presencemanager.lua
index 8fdf3612..f94ffd55 100644
--- a/core/presencemanager.lua
+++ b/core/presencemanager.lua
@@ -95,13 +95,16 @@ function handle_normal_presence(origin, stanza, core_route_stanza)
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;