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:
parent
a9ac10e876
commit
8e88fa3884
|
@ -870,12 +870,15 @@ c2s_self_presence(Acc) ->
|
||||||
Acc.
|
Acc.
|
||||||
|
|
||||||
-spec unset_presence(binary(), binary(), binary(), binary()) -> ok.
|
-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,
|
Resources = ejabberd_sm:get_user_resources(LUser,
|
||||||
LServer),
|
LServer),
|
||||||
?DEBUG("Unset_presence for ~p @ ~p / ~p -> ~p "
|
?DEBUG("Unset_presence for ~p @ ~p / ~p -> ~p "
|
||||||
"(~p resources)",
|
"(~p resources)",
|
||||||
[LUser, LServer, Resource, Status, length(Resources)]),
|
[LUser, LServer, LResource, Status, length(Resources)]),
|
||||||
case length(Resources) of
|
case length(Resources) of
|
||||||
0 ->
|
0 ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
|
|
Loading…
Reference in New Issue