Software /
code /
prosody
Comparison
plugins/mod_presence.lua @ 1019:8d750336e517
mod_presence: Fix incorrect internal routing for probes and subscriptions
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 21 Apr 2009 20:52:11 +0500 |
parent | 1011:beb039827c9f |
child | 1023:c0a3ef0a1f34 |
comparison
equal
deleted
inserted
replaced
1018:686fbeb411e3 | 1019:8d750336e517 |
---|---|
39 core_route_stanza(origin, stanza); | 39 core_route_stanza(origin, stanza); |
40 end | 40 end |
41 end | 41 end |
42 | 42 |
43 function handle_normal_presence(origin, stanza, core_route_stanza) | 43 function handle_normal_presence(origin, stanza, core_route_stanza) |
44 error("hello world") | |
44 if origin.roster then | 45 if origin.roster then |
45 for jid in pairs(origin.roster) do -- broadcast to all interested contacts | 46 for jid in pairs(origin.roster) do -- broadcast to all interested contacts |
46 local subscription = origin.roster[jid].subscription; | 47 local subscription = origin.roster[jid].subscription; |
47 if subscription == "both" or subscription == "from" then | 48 if subscription == "both" or subscription == "from" then |
48 stanza.attr.to = jid; | 49 stanza.attr.to = jid; |
238 if origin.type == "c2s" then | 239 if origin.type == "c2s" then |
239 if to ~= nil and not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then -- directed presence | 240 if to ~= nil and not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then -- directed presence |
240 origin.directed = origin.directed or {}; | 241 origin.directed = origin.directed or {}; |
241 origin.directed[to] = true; | 242 origin.directed[to] = true; |
242 end | 243 end |
243 if to == nil and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then | 244 if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then |
244 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); | 245 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); |
245 elseif not to then | 246 elseif not to then |
246 handle_normal_presence(origin, stanza, core_route_stanza); | 247 handle_normal_presence(origin, stanza, core_route_stanza); |
247 else | 248 else |
248 core_route_stanza(origin, stanza); | 249 core_route_stanza(origin, stanza); |
249 end | 250 end |
250 elseif (origin.type == "s2sin" or origin.type == "component") and hosts[host] then | 251 elseif (origin.type == "s2sin" or origin.type == "component") and hosts[host] then |
251 if to == nil and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then | 252 if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then |
252 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); | 253 handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza); |
253 else | 254 else |
254 core_route_stanza(origin, stanza); | 255 core_route_stanza(origin, stanza); |
255 end | 256 end |
256 end | 257 end |