Software /
code /
prosody
Comparison
plugins/mod_presence.lua @ 3112:c311fdffccce
mod_presence: Don't send 'unsubscribed' in response to probes when roster loading fails.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 24 May 2010 00:37:15 +0500 |
parent | 3109:34280b1544fc |
child | 3153:fd435cab928f |
child | 3193:a31559c52842 |
comparison
equal
deleted
inserted
replaced
3111:826cb5f1859b | 3112:c311fdffccce |
---|---|
226 local st_from, st_to = stanza.attr.from, stanza.attr.to; | 226 local st_from, st_to = stanza.attr.from, stanza.attr.to; |
227 stanza.attr.from, stanza.attr.to = from_bare, to_bare; | 227 stanza.attr.from, stanza.attr.to = from_bare, to_bare; |
228 log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); | 228 log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare); |
229 | 229 |
230 if stanza.attr.type == "probe" then | 230 if stanza.attr.type == "probe" then |
231 if rostermanager.is_contact_subscribed(node, host, from_bare) then | 231 local result, err = rostermanager.is_contact_subscribed(node, host, from_bare); |
232 if result then | |
232 if 0 == send_presence_of_available_resources(node, host, st_from, origin, core_route_stanza) then | 233 if 0 == send_presence_of_available_resources(node, host, st_from, origin, core_route_stanza) then |
233 core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- TODO send last activity | 234 core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- TODO send last activity |
234 end | 235 end |
235 else | 236 elseif not err then |
236 core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unsubscribed"})); | 237 core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unsubscribed"})); |
237 end | 238 end |
238 elseif stanza.attr.type == "subscribe" then | 239 elseif stanza.attr.type == "subscribe" then |
239 if rostermanager.is_contact_subscribed(node, host, from_bare) then | 240 if rostermanager.is_contact_subscribed(node, host, from_bare) then |
240 core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="subscribed"})); -- already subscribed | 241 core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="subscribed"})); -- already subscribed |