mod_presence: Don't send 'unsubscribed' in response to probes when roster loading...
authorWaqas Hussain <waqas20@gmail.com>
Sun, 23 May 2010 19:37:15 +0000 (00:37 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Sun, 23 May 2010 19:37:15 +0000 (00:37 +0500)
plugins/mod_presence.lua

index 255faecc97e767bed11ee0666a2a699bd3ca7b75..9071ae4c53291f9132975bc24d19f51c3fdafd2d 100644 (file)
@@ -228,11 +228,12 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b
        log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare);
        
        if stanza.attr.type == "probe" then
-               if rostermanager.is_contact_subscribed(node, host, from_bare) then
+               local result, err = rostermanager.is_contact_subscribed(node, host, from_bare);
+               if result then
                        if 0 == send_presence_of_available_resources(node, host, st_from, origin, core_route_stanza) then
                                core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- TODO send last activity
                        end
-               else
+               elseif not err then
                        core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unsubscribed"}));
                end
        elseif stanza.attr.type == "subscribe" then