25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-19 15:32:08 +02:00

Make set_presence command return error when session not found

Should fix issue #4274
This commit is contained in:
Paweł Chmielowski 2024-09-02 12:01:56 +02:00
parent 5f47860ee1
commit 017b2feac1

View File

@ -1425,8 +1425,10 @@ set_presence(User, Host, Resource, Type, Show, Status, Priority) ->
show = misc:binary_to_atom(Show),
priority = Priority,
sub_els = []},
Ref = ejabberd_sm:get_session_pid(User, Host, Resource),
ejabberd_c2s:set_presence(Ref, Pres).
case ejabberd_sm:get_session_pid(User, Host, Resource) of
none -> throw({error, "User session not found"});
Ref -> ejabberd_c2s:set_presence(Ref, Pres)
end.
user_sessions_info(User, Host) ->
lists:filtermap(fun(Resource) ->