MUC: Added multi-session support to the room-exiting occupant use case.
[prosody.git] / plugins / mod_presence.lua
index a077d7bd20471227b0771abc2d025b171b4492c7..d696612d9d7941b1b62f82bf8722fd7f23e6ebf7 100644 (file)
@@ -29,7 +29,7 @@ function core_route_stanza(origin, stanza)
        if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then
                local node, host = jid_split(stanza.attr.to);
                host = hosts[host];
-               if host and host.type == "local" then
+               if node and host and host.type == "local" then
                        handle_inbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to), core_route_stanza);
                        return;
                end
@@ -165,6 +165,7 @@ end
 
 function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare, core_route_stanza)
        local node, host = jid_split(from_bare);
+       if to_bare == origin.username.."@"..origin.host then return; end -- No self contacts
        local st_from, st_to = stanza.attr.from, stanza.attr.to;
        stanza.attr.from, stanza.attr.to = from_bare, to_bare;
        log("debug", "outbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare);