Software /
code /
prosody-modules
Changeset
6185:c887820cd884
Check both localpart and host
In case sending a message to someone with same username as you
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Mon, 03 Feb 2025 17:04:23 -0500 |
parents | 6184:56d1e059f68c |
children | 6186:1cf563a94620 |
files | mod_push2/mod_push2.lua |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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