# HG changeset patch # User Stephen Paul Weber # Date 1738620263 18000 # Node ID c887820cd8847ae2cf8e0fdac99f479c81eda108 # Parent 56d1e059f68c7eb19c3eb866b536d6804fba6762 Check both localpart and host In case sending a message to someone with same username as you diff -r 56d1e059f68c -r c887820cd884 mod_push2/mod_push2.lua --- a/mod_push2/mod_push2.lua Mon Feb 03 17:25:34 2025 +0100 +++ b/mod_push2/mod_push2.lua Mon Feb 03 17:04:23 2025 -0500 @@ -509,11 +509,13 @@ stanza:tag("stanza-id", { xmlns = "urn:xmpp:sid:0", by = event.for_user.."@"..module.host, id = event.id }):up() local user_session = host_sessions[event.for_user] and host_sessions[event.for_user].sessions or {} local to = stanza.attr.to - to = to and jid.split(to) or event.origin.username + local to_user, to_host = to and jid.split(to) + to_user = to_user or event.origin.username + to_host = to_host or module.host -- only notify if the stanza destination is the mam user we store it for - if event.for_user == to then - local user_push_services = push2_registrations:get(to) or {} + if event.for_user == to_user and to_host == module.host then + local user_push_services = push2_registrations:get(to_user) or {} -- Urgent stanzas are time-sensitive (e.g. calls) and should -- be pushed immediately to avoid getting stuck in the smacks @@ -522,7 +524,7 @@ local notify_push_services; if is_voip_stanza then - module:log("debug", "Urgent push for %s (%s)", to, urgent_reason); + module:log("debug", "Urgent push for %s@%s (%s)", to_user, to_host, urgent_reason); notify_push_services = user_push_services; else -- only notify nodes with no active sessions (smacks is counted as active and handled separate) @@ -543,7 +545,7 @@ end end - handle_notify_request(stanza, to, notify_push_services, true); + handle_notify_request(stanza, to_user, notify_push_services, true); end end