We want to use the privacy module in order to reduce the amount of
battery used for a mobile client. The idea is that the client will push
and activate a list blocking all the incoming presence info when it goes
to sleep.

In our tests we found that this works only if the resource at the phone
is the one with higher priority. As soon as a second resource binds, the
privacy list that the module is actually checking is the last one, not
the previous one.

> function preCheckIncoming(e)
>   local session;
>   if e.stanza.attr.to ~= nil then
>     local node, host, resource = jid_split(e.stanza.attr.to);
>     if node == nil or host == nil then
>       return;
>     end
>     if resource == nil then
>       local prio = 0;
>       if bare_sessions[node.."@"..host] ~= nil then
>         for resource, session_ in 
> pairs(bare_sessions[node.."@"..host].sessions) do
>           if session_.priority ~= nil and session_.priority > prio then
>             session = session_;
>             prio = session_.priority;
>           end
>         end
>       end
>     else
>       session = full_sessions[node.."@"..host.."/"..resource];
>     end
>     if session ~= nil then
>       return checkIfNeedToBeBlocked(e, session);
>     else
>       --module:log("debug", "preCheckIncoming: Couldn't get session for jid: 
> %s@%s/%s", tostring(node), tostring(host), tostring(resource));
>     end
>   end
> end

So, the presence stanza (from: A@dom to: B@domain) fires
pre-presence/full (preCheckOutgoing) and later presence/bare
(preCheckIncoming). The privacy list of the resource with higher
priority is checked. Then the presence/bare hook from mod_presence gets
executed, and sends the presence stanza to the sessions with presence of
that user. All of them, no matter if the resource has a privacyList

So, from our POV this is not the right behaviour, a session has a
privacyList activated and it has to be honoured.


You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prosody-dev+unsubscr...@googlegroups.com.
To post to this group, send email to prosody-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/prosody-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to