mod_shared_roster: Normalize JID on unset_presence

Don't forget to normalize the JID handed over from ejabberd_sm on
presence-unavailable.  Without normalization, mod_shared_roster might
fail to look up the storage backend for the given host name, for
example.

Fixes #3752.
This commit is contained in:
Holger Weiss 2022-01-15 18:18:24 +01:00
parent a9ac10e876
commit 8e88fa3884
1 changed files with 5 additions and 2 deletions

View File

@ -870,12 +870,15 @@ c2s_self_presence(Acc) ->
Acc.
-spec unset_presence(binary(), binary(), binary(), binary()) -> ok.
unset_presence(LUser, LServer, Resource, Status) ->
unset_presence(User, Server, Resource, Status) ->
LUser = jid:nodeprep(User),
LServer = jid:nameprep(Server),
LResource = jid:resourceprep(Resource),
Resources = ejabberd_sm:get_user_resources(LUser,
LServer),
?DEBUG("Unset_presence for ~p @ ~p / ~p -> ~p "
"(~p resources)",
[LUser, LServer, Resource, Status, length(Resources)]),
[LUser, LServer, LResource, Status, length(Resources)]),
case length(Resources) of
0 ->
lists:foreach(