plugins/mod_presence.lua

changeset 3215
e55782f20679
parent 3202
5a4e766a3577
child 3235
651139e831b1
equal deleted inserted replaced
3214:a69d8021b1db 3215:e55782f20679
271 if t ~= nil and t ~= "unavailable" and t ~= "error" then -- check for subscriptions and probes 271 if t ~= nil and t ~= "unavailable" and t ~= "error" then -- check for subscriptions and probes
272 return handle_outbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to)); 272 return handle_outbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to));
273 end 273 end
274 274
275 local to_bare = jid_bare(to); 275 local to_bare = jid_bare(to);
276 if not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then -- directed presence 276 local roster = origin.roster;
277 if roster and not(roster[to_bare] and (roster[to_bare].subscription == "both" or roster[to_bare].subscription == "from")) then -- directed presence
277 origin.directed = origin.directed or {}; 278 origin.directed = origin.directed or {};
278 if t then -- removing from directed presence list on sending an error or unavailable 279 if t then -- removing from directed presence list on sending an error or unavailable
279 origin.directed[to] = nil; -- FIXME does it make more sense to add to_bare rather than to? 280 origin.directed[to] = nil; -- FIXME does it make more sense to add to_bare rather than to?
280 else 281 else
281 origin.directed[to] = true; -- FIXME does it make more sense to add to_bare rather than to? 282 origin.directed[to] = true; -- FIXME does it make more sense to add to_bare rather than to?

mercurial