aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-12-25 04:58:15 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-12-25 04:58:15 +0500
commitf963d6de4a808f498233b4dfa5cb01ebd0e26655 (patch)
treef877e05a8df1d484811c0c8827d1a3c4079bd293
parentbc031ae346c3f05743c1922ba614a768c0160021 (diff)
downloadprosody-f963d6de4a808f498233b4dfa5cb01ebd0e26655.tar.gz
prosody-f963d6de4a808f498233b4dfa5cb01ebd0e26655.zip
Directed presence
-rw-r--r--core/presencemanager.lua9
-rw-r--r--core/stanza_router.lua4
2 files changed, 12 insertions, 1 deletions
diff --git a/core/presencemanager.lua b/core/presencemanager.lua
index e4dd6cc4..4d847563 100644
--- a/core/presencemanager.lua
+++ b/core/presencemanager.lua
@@ -103,7 +103,14 @@ function handle_normal_presence(origin, stanza, core_route_stanza)
end
origin.priority = 0;
if stanza.attr.type == "unavailable" then
- origin.presence = nil;
+ origin.presence = nil;
+ if origin.directed then
+ for _, jid in ipairs(origin.directed) do
+ stanza.attr.to = jid;
+ core_route_stanza(origin, stanza);
+ end
+ origin.directed = nil;
+ end
else
origin.presence = stanza;
local priority = stanza:child_with_name("priority");
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 2fef1e34..ac32baa2 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -110,6 +110,10 @@ function core_process_stanza(origin, stanza)
elseif origin.type ~= "c2s" and stanza.name == "iq" and not resource then -- directed at bare JID
core_handle_stanza(origin, stanza);
else
+ if origin.type == "c2s" and stanza.name == "presence" and to ~= nil and not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then
+ origin.directed = origin.directed or {};
+ t_insert(origin.directed, to); -- FIXME does it make more sense to add to_bare rather than to?
+ end
core_route_stanza(origin, stanza);
end
else